[SciPy-user] Bug in scipy.sparse

Olivier Verdier zelbier@gmail....
Wed Oct 31 06:01:50 CDT 2007


The first thing I'm surprised about with scipy.sparse is that it uses the
matrix type instead of the array type. This is very unfortunate, in my
opinion.
The bug is that a sparse matrix won't work correctly with `dot` and `array`:

spmat = speye(3,3)
vec  = array([1,0,0])

dot(spmat, vec)
returns:
array([  (0, 0) 1.0
  (1, 1)        1.0
  (2, 2)        1.0,
         (0, 0) 0.0
  (1, 1)        0.0
  (2, 2)        0.0,
         (0, 0) 0.0
  (1, 1)        0.0
  (2, 2)        0.0], dtype=object)

Ouch!!

The right result may however be obtained with spmat * vec.

This is a pity because any code that works with arrays or matrices in
general and uses `dot` to do the matrix vector multiplication will be
*broken* with sparse matrices.

How reliable is scipy.sparse? Is there any plan to make it more compatible
with the array type? Behave like the array type? How can I help?

== Olivier
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-user/attachments/20071031/955c5ef0/attachment.html 


More information about the SciPy-user mailing list