[SciPy-User] flattened index for Sparse Matrix?
braingateway
braingateway at gmail.com
Thu Nov 4 09:44:23 EDT 2010
Lutz Maibaum :
> On Wed, Nov 3, 2010 at 12:12 PM, LittleBigBrain <braingateway at gmail.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()?
>>
>
>
Thanks a lot! Then what about the first question? How could I index the
sparse matrix as flattened version?
> 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
> fact dense.
>
> Hope this helps,
>
> Lutz
> _______________________________________________
> SciPy-User mailing list
> SciPy-User at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>
More information about the SciPy-User
mailing list