[SciPy-user] Sparse matrix todense
Dinesh B Vadhia
dineshbvadhia at hotmail.com
Thu Apr 24 18:18:03 EDT 2008
Hi! The following code worked until I installed the latest svn. I want to select a particular row (eg. row=1818) from the sparse matrix A:
> import numpy
> import scipy
> from scipy import sparse
<snip>
> A = sparse.csr_matrix(A)
> q[0,:] = sparse.csr_matrix.todense(sparse.csr_matrix.getrow(A, 1818))
The Traceback is:
Traceback (most recent call last):
File "C:\...\.py", line 157, in <module>
q[0,:] = sparse.csr_matrix.todense(sparse.csr_matrix.getrow(A, 1818))
File "C:\Python25\Lib\site-packages\scipy\sparse\base.py", line 357, in getrow
a = csr_matrix((1, m), dtype=self.dtype)
NameError: global name 'csr_matrix' is not defined
Thanks!
Dinesh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20080424/12d4ee1a/attachment.html>
More information about the SciPy-User
mailing list