Mercurial > hg > smallbox
annotate Problems/private/sprow.m @ 15:51b76c31c93d
(none)
author | idamnjanovic |
---|---|
date | Thu, 25 Mar 2010 14:05:27 +0000 |
parents | |
children |
rev | line source |
---|---|
idamnjanovic@15 | 1 %SPROW Extract row of sparse matrix. |
idamnjanovic@15 | 2 % X = SPROW(A,J) where A is a sparse matrix, returns the nonzero values in |
idamnjanovic@15 | 3 % the row A(J,:). |
idamnjanovic@15 | 4 % |
idamnjanovic@15 | 5 % [X,ID] = SPROW(A,J) also returns the column indices of the nonzeros. |
idamnjanovic@15 | 6 % |
idamnjanovic@15 | 7 % Note that the call [X,ID] = SPROW(A,J) is equivalent (but more efficient |
idamnjanovic@15 | 8 % than) the Matlab code |
idamnjanovic@15 | 9 % |
idamnjanovic@15 | 10 % IDS = find(A(J,:)); |
idamnjanovic@15 | 11 % X = A(J,IDS); |
idamnjanovic@15 | 12 |
idamnjanovic@15 | 13 |
idamnjanovic@15 | 14 % Ron Rubinstein |
idamnjanovic@15 | 15 % Computer Science Department |
idamnjanovic@15 | 16 % Technion, Haifa 32000 Israel |
idamnjanovic@15 | 17 % ronrubin@cs |
idamnjanovic@15 | 18 % |
idamnjanovic@15 | 19 % August 2009 |