[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: iterating through the rows of a sparse matrix
From: |
dbateman |
Subject: |
Re: iterating through the rows of a sparse matrix |
Date: |
Sat, 8 Dec 2007 11:48:18 -0800 (PST) |
Tirumurti, Chandra wrote:
>
> Hello,
>
>
>
> New to Octave and loving it. I do have a question. I have a matrix X =
>
>
>
> 0 1
>
> 2 3
>
>
>
> [ri, ci] = spfind(X); gives me the row indices of non-zero elements in
> ri and column indices in ci.
>
> Is there a way to do the other way, ie, I want to get a list by row.
>
>
The transpose operator is quite efficient on sparse matrix and so
[ci, ri] = spfind(X.');
is probably the easiest. There are certainly faster means that are more
complex.
D.
--
View this message in context:
http://www.nabble.com/iterating-through-the-rows-of-a-sparse-matrix-tf4965965.html#a14231949
Sent from the Octave - General mailing list archive at Nabble.com.