[SciPy-User] how to obtain I, J, V from sparse matrix (V, (I, J)) ?

Pauli Virtanen pav@iki...
Tue Mar 20 16:55:31 CDT 2012


20.03.2012 22:08, Jose Borreguero kirjoitti:
> Scipy docs state one can construct a matrix from three 1D
> arrays,A=sparse.coo_matrix((V,(I,J)),shape=(4,4))
> 
> However, given sparse matrix A, how can I obtain arrays V, I, and J?
> I could not find any methods of the sparse matrix that would return these arrays...

Check out the `data`, `row` and `col` attributes:

http://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.coo_matrix.html



More information about the SciPy-User mailing list