[SciPy-user] problems about printing sparse matrix and setting coo_matrix

hollowspook at gmail.com hollowspook at gmail.com
Sun Nov 26 22:32:02 CST 2006

Hi, there

The following is my problems.

>>> from numpy import *
>>> from scipy import *
>>> Y = sparse.coo_matrix(None, (3, 3), dtype=complex)
>>> Y.getmaxprint()
>>> Y.setdiag([1,2,3])
Traceback (most recent call last):
File "<interactive input>", line 1, in ?
File "D:\PROGRA~1\Python24\Lib\site-packages\scipy\sparse\sparse.py",
line 426, in setdiag
self[i, i+k] = v
File "D:\PROGRA~1\Python24\Lib\site-packages\scipy\sparse\sparse.py",
line 237, in __getattr__
raise AttributeError, attr + " not found"
AttributeError: __setitem__ not found
Why 50 is displayed in shell
why Y.setdiag is wrong?
However if Y is a csr_matrix. Y.setdiag is ok.

BTW I use enhanced python version

Thanks in advance


More information about the SciPy-user mailing list