[SciPy-dev] conversion among sparse formats

Nathan Bell wnbell@gmail....
Sat Dec 8 11:37:10 CST 2007


http://projects.scipy.org/scipy/scipy/changeset/3622

I made some improvements to address the tolil() problem.  The lil_matrix()
constructor was also simplified by using csr_matrix() to handle the
conversions.  Here are the new results:

                    Sparse Matrix Conversion
====================================================================
 format |  tocsr()  |  tocsc()  |  tocoo()  |  tolil()  |  todok()
--------------------------------------------------------------------
  csr   |  0.000002 |  0.000293 |  0.000350 |  0.006667 |    n/a
  csc   |  0.000295 |  0.000002 |  0.000391 |  0.007143 |    n/a
  coo   |  0.000382 |  0.000375 |  0.000002 |  0.007143 |    n/a
  lil   |  0.025000 |  0.024000 |  0.022000 |  0.000002 |    n/a
  dok   |  0.025000 |  0.070000 |  0.025000 |  0.030000 |    n/a


For comparison, here are the original figures:

                     Sparse Matrix Conversion
====================================================================
format |  tocsr()  |  tocsc()  |  tocoo()  |  tolil()  |  todok()
--------------------------------------------------------------------
 csr   |  0.000002 |  0.000292 |  0.000356 |  3.460000 |    n/a
  csc   |  0.000312 |  0.000002 |  0.000358 |  3.450000 |    n/a
 coo   |  0.000389 |  0.000361 |  0.000002 |  3.460000 |    n/a
 lil   |  0.024000 |  0.024000 |  0.022000 |  3.540000 |    n/a
 dok   |  0.027500 |  0.060000 |  0.025000 |  3.510000 |    n/a


-- 
Nathan Bell wnbell@gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-dev/attachments/20071208/58ef6d60/attachment.html 


More information about the Scipy-dev mailing list