[SciPy-user] accessing only the nonzero elements of a sparse matrix
Sat Jun 28 21:18:00 CDT 2008
It doesn't seem like anything like the numpy arrays method ``nonzero''
is implemented for scipy's sparse matrices. What I am looking for is
A = sparse.spidentity(3);
(array([0, 1, 2]), array([0, 1, 2]))
I guess I could convert to coordinate form 'COO' and then access the
"row" and "col" fields but this seems a little evil as it relies on
properties of the 'COO' matrix which could change in the future. It
would be nicer to have a uniform method of all sparse matrix types.
Thanks for any info on this,
More information about the SciPy-user