[SciPy-user] efficiency of sparse matrix multiplication

Andrew Swan andrew.a.swan at gmail.com
Wed Nov 1 19:08:11 CST 2006


Hi - I have two matrices x and z I want to multiply together in various
ways. They look like:

x.shape() = (9318,14)
x.nnz() = 30343
z.shape() = (9318,11419)
z.nnz() = 9271

I have found that the multiplications are taking longer than I had hoped
for. The speeds when they are in linked list and csc format are as follows:

sparse.lil_matrix:
x.T * x   0.85s
x.T * z   1.38s
z.T * x   4.75s
z.T * z   2.98s

sparse.csc_matrix (not including the conversion from lil to csc):
x.T * x   0.63s
x.T * z   1.49s
z.T * x   3.99s
z.T * z   2.58s

Using csr format didn't work at all (had to kill it after more than an
hour!)

I imagined csc should be significantly faster than lil? Could the fact that
it's not be related to the compilation of scipy/blas etc on my computer?
It's a fairly new amd64 running fedora5. I compiled scipy myself, after
installing standard rpms for blas and lapack libraries.

Thanks in advance

Andrew Swan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-user/attachments/20061102/0e2c036c/attachment.html 


More information about the SciPy-user mailing list