Hey Jenny, I thought I could chip in.
On Sep 17, 8:28 pm, "J. Cooley" <j.a.coo...@warwick.ac.uk> wrote: > Hi William, > > Thank you for all the information. I have spent time this morning > going through it all, the alarm thing is really useful ~ I also > discovered Ctl-C, which seems to be quite handy! (I am REALLY new to > this! John had shown me, but I forgot.) > > > * check out the @parallel decorator (note that you can't pickle and > > send elliptic curves with @parallel due to some unresolved issue > > involving forking an pari, so just send their Cremona label instead). > > I've had a look at this, I'm not very sure of what it's doing; is it > just allowing one to apply a function repetitively to all the elements > of a list? >From what I can tell, the @parallel makes an algorithm run on lists in parallel -- this will exploit multiple cores. > > The thing I thought I could try is: > > from sage.databases.cremona import LargeCremonaDatabase > database = CremonaDatabase().list(range(1, N)) > # This list function returns all the elliptic curves in the database > with conductors in the list given. I'd like to have N = 130001 in > order to do it all at once, but it might be better to do it in stages. You'll probably want to use an iterator instead. It should be much less memory-intensive. Additionally, ``xrange``s are especially optimized for iteration. database = CremonaDatabase().iter(xrange(1, 130001)) > > old = [E.isogeny_class()[0] for E in database] # takes 14 seconds > for N=50 > new = [E.isogeny_class_new()[0] for E in database] > # "old" and "new" are both lists of lists > > i = 0 > while i<len(database): # or, better, give a number > old = old[i] > old.sort() > new = new[i] > new.sort() You'll probably want an iterator here too. List access takes time ( O (n) ). from itertools import izip for old_item, new_item in izip(old, new): # ``izip`` creates an iterator that puts each corresponding item in a sequence of sequences in a tuple. http://docs.python.org/library/itertools.html#itertools.izip old_item.sort() new_item.sort() Also, are you sure they are not already sorted? > try: > new == old > except Exception, msg: > record_failure(msg) I am unsure of what this code is supposed to do. Does the code raise exceptions when comparison fails? You may be thinking of: # Somewhere before the loop... failures = [] ... if new != old: failures.append( (old, new) ) > i = i+1 > > Is this a horrendously convoluted way of doing it? > > My other remaining problem is how to run the test on another core(s) > while I get on with other things. I found a thing called dsage; would > that be the thing to use? > > Many thanks once again, > > Jenny --~--~---------~--~----~------------~-------~--~----~ To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---