[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()
50
>>> 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
>>>
-----------------------------------------------------------------------------------------------------
question1:
Why 50 is displayed in shell
question2:
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


Sam



More information about the SciPy-user mailing list