[SciPy-User] flattened index for Sparse Matrix?
Wed Nov 3 14:32:34 CDT 2010
On Wed, Nov 3, 2010 at 12:12 PM, LittleBigBrain <email@example.com> wrote:
> I am trying sparse matrix these days. I am wondering is there any way
> I can access the sparse matrix with flattened index?
> And is there any more delicate way to obtain max, min of a sparse
> matrix than a[a.nonzero()].max()?
It probably depends on which sparse matrix type you are using. For a
CSR matrix, for example, the data member contains the values of all
non-zero elements. You could do something like a.data.max(), but you
will still have to compare the result to 0 unless the matrix is in
Hope this helps,
More information about the SciPy-User