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


--
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To post to this group, send email to sage-support@googlegroups.com.
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support?hl=en.


Reply via email to