[Scipy-tickets] [SciPy] #858: faster sparse matrices

SciPy scipy-tickets@scipy....
Fri Jan 30 14:01:59 CST 2009

#858: faster sparse matrices
 Reporter:  sascha.baumanns          |        Owner:  wnbell  
     Type:  task                     |       Status:  assigned
 Priority:  normal                   |    Milestone:  0.8.0   
Component:  scipy.sparse             |      Version:  devel   
 Severity:  normal                   |   Resolution:          
 Keywords:  cython, sparse, speedup  |  
Changes (by wnbell):

  * milestone:  Unscheduled => 0.8.0


 Thanks for the feedback Sascha.

 The lil_matrix implementation is currently pure-Python so it's definitely
 slow.  If a cython implementation was faster, then we'd definitely include
 it in SciPy.

 CSR/CSC matrix addition is slow because it sorts the column indices within
 each row before computing the sum.  Previously I had an implementation
 that did not require sorted indices, but for simplicity I went with the
 sort + add approach.  I will add the more general method back in for SciPy
 0.8 (and maybe a backport for 0.7.1) as an alternative when the indices
 are not sorted.  Note that MATLAB requires sorted indices, so it never has
 this issue.  If you first do A.sort_indices() B.sort_indices, and then
 call C = A + B, SciPy ought to be roughly the same speed as MATLAB for the
 actual addition.

 sparse.bmat() shouldn't be too terribly slow.  It does do more work than
 is strictly necessary for cases where all the matrices are in CSR/CSC
 format.  Can you provide MATLAB and Python scripts that illustrate the
 performance problem?  We can then look at optimizing that case and
 speeding things up a bit.

Ticket URL: <http://scipy.org/scipy/scipy/ticket/858#comment:3>
SciPy <http://www.scipy.org/>
SciPy is open-source software for mathematics, science, and engineering.

More information about the Scipy-tickets mailing list