Sparse Matrix indexing

I need to built a sparse matrix for large matrix in order to avoid entering out of memory. Can a sparse matrix be build like: n=792;m=1000;j=2; A=sparse((n+3)*j+1,(3*n+m-1)*j); %then filling up this zero matrix with ones at certain rows and %columns like A(1:n*j,1:n*j)=eye(n*j,n*j);
I know this will increase the execution time but this will save me lot memory right?. Is there any other method I can perform

 採用された回答

Titus Edelhofer
Titus Edelhofer 2011 年 6 月 14 日

0 投票

Hi Samir,
more or less that's the way to go. Take a look at the function speye, spdiags and the others under "See also" that help build up your matrix (in your example "eye" is a full matrix, whereas you want only to set the diagonal).
Titus

1 件のコメント

Samir
Samir 2011 年 6 月 14 日
Thanks

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeResizing and Reshaping Matrices についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by