Hi,

I have some questions about arithmetic speed.  I'm comparing my pyrexified 
version of the number field with patch at:
http://sage.math.washington.edu/home/jbmohler/patches/number_field_element_2007_03_26.patch

As we might expect, after hammering at the integers for quite a long time, 
magma 
beats the number field arithmetic too.  The speed difference is comparable for 
addition, subtraction, and multiplication.  However, we've got issues with 
division.  Some speed comparisons are at the bottom.

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.  Is there a much better way to find an inverse 
than 
the extended euclidean algorithm?  I observe that the old python implementation 
asked pari for the inverse and it was also extremely slow -- perhaps for other 
reasons.

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?

--
Joel

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/
-~----------~----~----~----~------~----~------~--~---

Reply via email to