[SciPy-dev] Possibly bug in Sparse.py

Robert Kern rkern at ucsd.edu
Thu Feb 17 09:44:31 CST 2005


Nils Wagner wrote:
> Hi all,
> 
> I am going to solve large-scale linear systems of equations.
> 
> The test matrices can be found at
> 
> http://www.imtek.uni-freiburg.de/simulation/benchmark/?li=30&nr=38886
> 
>  File "meerbergen.py", line 34, in ?
>    y, info = linalg.bicgstab(omega[i]*B-A,v)
>  File "/usr/lib/python2.3/site-packages/scipy/sparse/Sparse.py", line 
> 441, in __sub__
>    c,rowc,ptrc,ierr = 
> func(data1,self.rowind,self.indptr,-data2,other.rowind,other.indptr)
>  File "/usr/lib/python2.3/site-packages/scipy/sparse/Sparse.py", line 
> 210, in __getattr__
>    raise AttributeError, attr + " not found."
> AttributeError: rowind not found.
> 
> 
>  >>> A
> <22692x22692 sparse matrix of type 'D' with 1482390 stored elements 
> (space for 1482390) in
>        COOrdinate format>
>  >>> B
> <22692x22692 sparse matrix of type 'd' with 1481988 stored elements 
> (space for 1481988) in
>        COOrdinate format>
>  >>> omega[i]
> (0.049939772810258624+0.0024533837163709009j)
>  >>>
> 
> Any suggestion would be appreciated.

Well, I'm not familiar with the code, but looking around for a few 
minutes, it appears that there are indeed bugs in the __sub__ and 
__rsub__ methods of csc_matrix. The implementation coerces "other" to be 
a csc_matrix, but then ignores the newly created object.

Fixed in CVS, I think. Travis, could you check to make sure I did the 
right thing?

-- 
Robert Kern
rkern at ucsd.edu

"In the fields of hell where the grass grows high
  Are the graves of dreams allowed to die."
   -- Richard Harter




More information about the Scipy-dev mailing list