iterating through the rows of a sparse matrix
dbateman
dbateman at free.fr
Sat Dec 8 13:48:18 CST 2007
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.
More information about the Help-octave
mailing list