[sage-devel] Re: Raising matrices to a power

2007-12-03 Thread Bill Hart
Then again, if one works in a number field in Magma instead of a quotient ring, it takes about a quarter of the time of SAGE to do the power. That's probably about comparable to what we'd get with a single scaling before and after doing the powering in SAGE. So it looks like when all the appropria

[sage-devel] Re: Raising matrices to a power

2007-12-03 Thread Bill Hart
Magma also takes 0.12s to do the polynomial expmod a^2 mod f, but when you raise the power to 20 or 200 Magma is not competitive any more. This is quite surprising, since as everyone knows, Magma is usually quite competitive with polynomial arithmetic. Bill. On 3 Dec, 18:26, Bill Har

[sage-devel] Re: Raising matrices to a power

2007-12-03 Thread Stephen Forrest
On Dec 3, 2007 3:42 PM, William Stein <[EMAIL PROTECTED]> wrote: > That won't work because nobody ever implement _maple_init_ as a method > for Sage matrices. Hmm, I'd be interested in looking into improving this myself. > > In any case, there's nothing syntactically tricky about matrix > > exp

[sage-devel] Re: Raising matrices to a power

2007-12-03 Thread William Stein
On Dec 3, 2007 12:30 PM, Stephen Forrest <[EMAIL PROTECTED]> wrote: > > On Dec 3, 2007 11:16 AM, William Stein <[EMAIL PROTECTED]> wrote: > [snip] > > I want to time maple, but I just spent 10 minutes and couldn't > > even figure out how to raise a matrix to a power! > > I couldn't get the Sage in

[sage-devel] Re: Raising matrices to a power

2007-12-03 Thread Stephen Forrest
On Dec 3, 2007 11:16 AM, William Stein <[EMAIL PROTECTED]> wrote: [snip] > I want to time maple, but I just spent 10 minutes and couldn't > even figure out how to raise a matrix to a power! I couldn't get the Sage interface to Maple to work properly with matrices. When I tried the following in S

[sage-devel] Re: Raising matrices to a power

2007-12-03 Thread William Stein
On Dec 3, 2007 10:26 AM, Bill Hart <[EMAIL PROTECTED]> wrote: > > > > On 3 Dec, 16:16, "William Stein" <[EMAIL PROTECTED]> wrote: > > > By the way, PARI is *not* competitive here: > > > > sage: nn = gp(n) > > sage: gp.eval('gettime; a = %s^2; gettime/1000.0'%nn.name()) > > '0.42800

[sage-devel] Re: Raising matrices to a power

2007-12-03 Thread Bill Hart
On 3 Dec, 16:16, "William Stein" <[EMAIL PROTECTED]> wrote: > By the way, PARI is *not* competitive here: > > sage: nn = gp(n) > sage: gp.eval('gettime; a = %s^2; gettime/1000.0'%nn.name()) > '0.428000' > sage: gp.eval('gettime; a = %s^20; gettime/1000.0'

[sage-devel] Re: Raising matrices to a power

2007-12-03 Thread Bill Hart
On 3 Dec, 16:16, "William Stein" <[EMAIL PROTECTED]> wrote: > Where are you getting the above timings from? I worked in QQ['x'].quotient(f) which is slower than working in a number field. Bill. --~--~-~--~~~---~--~~ To post to this group, send email to sage-deve

[sage-devel] Re: Raising matrices to a power

2007-12-03 Thread mhampton
On my system, for this example sage takes .36 seconds, and mathematica takes 3.86 seconds, so sage is about 10 times faster. -MH On Dec 3, 10:42 am, Jason Grout <[EMAIL PROTECTED]> wrote: > William Stein wrote: > > On Dec 3, 2007 8:13 AM, Bill Hart <[EMAIL PROTECTED]> wrote: > >> I did try to c

[sage-devel] Re: Raising matrices to a power

2007-12-03 Thread William Stein
On Dec 3, 2007 8:42 AM, Jason Grout <[EMAIL PROTECTED]> wrot > > > William Stein wrote: > > On Dec 3, 2007 8:13 AM, Bill Hart <[EMAIL PROTECTED]> wrote: > >> I did try to check that Mathematica was getting the right answer, but > >> I had no luck. I don't know how to convert a mathematica matrix i

[sage-devel] Re: Raising matrices to a power

2007-12-03 Thread Jason Grout
William Stein wrote: > On Dec 3, 2007 8:13 AM, Bill Hart <[EMAIL PROTECTED]> wrote: >> I did try to check that Mathematica was getting the right answer, but >> I had no luck. I don't know how to convert a mathematica matrix into >> ordinary matrix form in SAGE, so when I do the comparison it alway

[sage-devel] Re: Raising matrices to a power

2007-12-03 Thread David Harvey
On Dec 3, 2007, at 11:20 AM, William Stein wrote: > > On Dec 3, 2007 8:13 AM, Bill Hart <[EMAIL PROTECTED]> wrote: >> I did try to check that Mathematica was getting the right answer, but >> I had no luck. I don't know how to convert a mathematica matrix into >> ordinary matrix form in SAGE, so

[sage-devel] Re: Raising matrices to a power

2007-12-03 Thread William Stein
On Dec 3, 2007 8:13 AM, Bill Hart <[EMAIL PROTECTED]> wrote: > I did try to check that Mathematica was getting the right answer, but > I had no luck. I don't know how to convert a mathematica matrix into > ordinary matrix form in SAGE, so when I do the comparison it always > just says false. Damn

[sage-devel] Re: Raising matrices to a power

2007-12-03 Thread William Stein
On Dec 3, 2007 5:40 AM, Bill Hart <[EMAIL PROTECTED]> wrote: > > I've just been looking at SAGE ticket number 173: > > http://www.sagemath.org:9002/sage_trac/ticket/173 > > The idea is that Mathematica raises a 3 dimensional matrix M over QQ > to the power 20,000 much faster than either SAGE or Ma

[sage-devel] Re: Raising matrices to a power

2007-12-03 Thread Bill Hart
I did try to check that Mathematica was getting the right answer, but I had no luck. I don't know how to convert a mathematica matrix into ordinary matrix form in SAGE, so when I do the comparison it always just says false. Bill. On 3 Dec, 15:21, Clement Pernet <[EMAIL PROTECTED]> wrote: > Hi th

[sage-devel] Re: Raising matrices to a power

2007-12-03 Thread Clement Pernet
Hi there, The method using x^k mod charpoly (or minpoly) is clearly the only method I know about for that problem. If n is smallish, this is the good way to do it. For larger n (say n=O(k)), the computation of the n power of A in step 3 is the bottleneck (n^4 or n^(w+1) ops in Q, so roughly O(

[sage-devel] Re: Raising matrices to a power

2007-12-03 Thread David Harvey
On Dec 3, 2007, at 8:40 AM, Bill Hart wrote: > I've just been looking at SAGE ticket number 173: > > http://www.sagemath.org:9002/sage_trac/ticket/173 > > The idea is that Mathematica raises a 3 dimensional matrix M over QQ > to the power 20,000 much faster than either SAGE or Magma. > > I don't