matlab - Accessing specific rows of a sparse matrix -


i have sparse matrix of size 20 millionx20million in matlab. want around 40000 specific rows matrix.

if do

new_data = data_original(index,:)  

where index consists of rows interested in, takes ever.

how can efficiently?

matlab seems use coordinate list (coo) format sparse matrices. in matlab's coo format, elements sorted column indices first raw indices among elements of same column indices. thus, every time specify element row index, matlab has search entire indices of sparse matrix elements right row indices.

it faster if can load original matrix transpose, access columns of sparse matrix, i.e.

new_data = data_transpose_of_original(:,index)  

however, don't transpose original matrix inside matlab, take longer.

or can create own sparse matrix format. compressed sparse row (csr) format fast row-wise access.

in conclusion, if can change format of sparse matrix outside matlab (take transpose of original matrix, or make csr format , create matlab function load/manipulate it.). can access element faster. otherwise cant think of speedup.


Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -