[SciPy-dev] Possibly bug in sparse.py

Nils Wagner nwagner at mecha.uni-stuttgart.de
Tue Feb 14 03:49:31 CST 2006


    C =dot(A,XX)+dot(XX,B)
  File "/usr/local/lib/python2.4/site-packages/scipy/sparse/sparse.py",
line 532, in __add__
    raise ValueError, "inconsistent shapes"
ValueError: inconsistent shapes
>>> A
<317x317 sparse matrix of type '<type 'float64scalar'>'
        with 7327 stored elements (space for 7327)
        in COOrdinate format>
>>> XX
array([[0, 1, 1, ..., 1, 1, 1],
       [1, 0, 1, ..., 1, 1, 1],
       [1, 1, 0, ..., 1, 1, 1],
       ...,
       [1, 1, 1, ..., 1, 1, 1],
       [1, 1, 1, ..., 1, 1, 1],
       [1, 1, 1, ..., 1, 1, 1]])
>>> shape(XX)
(317, 10)
>>> shape(B)
(10, 10)

>>> B
<10x10 sparse matrix of type '<type 'float64scalar'>'
        with 28 stored elements (space for 28)
        in Compressed Sparse Column format>
 
How can I fix this problem ?

Nils




More information about the Scipy-dev mailing list