Re: Sage 5.4 determinant is very slow

80 views
Skip to first unread message

P Purkayastha

unread,
Nov 14, 2012, 6:09:59 AM11/14/12
to sage-s...@googlegroups.com
On 11/14/2012 06:59 AM, platane wrote:
> In Sage 5.4 determinant for dense matrix is very slow. For the following Hankel determinant calculation, Sage 4.6.1 is 100000 time more fast than Sage 5.4 (!!):
>
> Sage 5.4, Sparse = False, Time=117.49
>
> Sage 4.6.1, Sparse=False, Time=0.0011
>
> # --------------------
> import time
>
> def test(K, SP):
> n=100
> f=taylor(prod((1-x**i) for i in range(1,n)),x,0,n)
> A=[f.coefficient(x,i) for i in range(n)]
> cf= [[A[i+j] for i in range(K)] for j in range(K)]
> m= matrix(ZZ, cf, sparse=SP)
> #
> t0=time.time()
> print " K =", K, ", result =", m.det()
> t_det= time.time()-t0
> print " ",version()
> print " sparse= ", SP
> print " time = ", t_det
>
> KK=30
> test(KK, True)
> print
> test(KK, False)
>
>
> # --------------------
>

It happened some time in between 4.7.2 and 4.8: (det.sage) is the above
code.


----------------------------------------------------------------------
| Sage Version 4.7.2, Release Date: 2011-10-29 |
| Type notebook() for the GUI, and license() for information. |
----------------------------------------------------------------------
sage: attach det.sage
K = 30 , result = -9
Sage Version 4.7.2, Release Date: 2011-10-29
sparse= True
time = 0.260323047638

K = 30 , result = -9
Sage Version 4.7.2, Release Date: 2011-10-29
sparse= False
time = 0.026487827301
sage:
Exiting Sage (CPU time 0m1.77s, Wall time 0m29.31s).
Exiting spawned Gap process.


----------------------------------------------------------------------
| Sage Version 4.8, Release Date: 2012-01-20 |
| Type notebook() for the GUI, and license() for information. |
----------------------------------------------------------------------
sage: attach det.sage
K = 30 , result = -9
Sage Version 4.8, Release Date: 2012-01-20
sparse= True
time = 0.011904001236

K = 30 , result = -9
Sage Version 4.8, Release Date: 2012-01-20
sparse= False
time = 122.02807498


platane

unread,
Nov 17, 2012, 6:13:07 PM11/17/12
to sage-s...@googlegroups.com
Thank you for finding the exact version having the determinant problem. 
Maybe we can compare the source codes of those two versions
to solve the problem.
Reply all
Reply to author
Forward
0 new messages