On Mar 27, 2007, at 10:26 AM, Joel B. Mohler wrote:
> First question, magma blows us way on division. Obviously, > division by an > integer (as in the timing below) could be made much faster by > utilizing the fact > that we have a scalar. However, this doesn't seem to be the issue > since I/I > produces comparable timings. But I/I is not scalar division, if you are representing I as the polynomial X in the ring Q[X]/(1+X^2). > Is there a much better way to find an inverse than > the extended euclidean algorithm? In general, I don't think so, but it's quite possible (in fact I think very likely) that magma has special code to deal with quadratic extensions, in which case obviously everything can be done much more efficiently. For more data points, you could try two things: (1) try the same tests as below, but for a more complicated number field, at least degree 4, with a pretty random looking defining polynomial, and (2) compare magma's performance in quadratic fields against its general number field stuff. > And here's a more general question. What's the current state of > our SageX art > for making these things fast? Does someone have a trick up their > sleeve to get > these basic arithmetic operations a bit faster from the python shell? At the moment there are so many different reasons that the code could be slow, I don't think you've at all pinned it down to a sagex issue yet. david > P.S.: Speed comparisons (all on sage.math). I've included the > basic integer > arithmetic example to show that the everything is off at about the > same factor > (6-10). > > [EMAIL PROTECTED]:~$ magma > Magma V2.13-5 Tue Mar 27 2007 07:12:02 on sage [Seed = > 1950028839] > Type ? for help. Type <Ctrl>-D to quit. >> C<I>:=QuadraticField(-1); >> time for x in [1..100000] do a:=I*I; end for; > Time: 0.260 >> time for x in [1..100000] do a:=I/2; end for; > Time: 0.370 >> time for x in [1..100000] do a:=1+1; end for; > Time: 0.020 > > sage: C.<I>=QuadraticField(-1) > sage: time for i in xrange(100000): a=I*I > CPU times: user 1.79 s, sys: 0.03 s, total: 1.82 s > Wall time: 1.82 > sage: time for i in xrange(100000): a=I/2 > CPU times: user 10.24 s, sys: 0.12 s, total: 10.37 s > Wall time: 10.37 > sage: time for i in xrange(100000): a=1+1 > CPU times: user 0.27 s, sys: 0.00 s, total: 0.27 s > Wall time: 0.27 --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~----------~----~----~----~------~----~------~--~---