How can I do a memory efficient sparse matrix multiplication?
古いコメントを表示
I have a sparse matrix A (dimension 4000000 x 1000000) and I want to calculate the matrix product:
B = A * A'
This results in: "Out of memory. Type HELP MEMORY for your options."
2 件のコメント
What is the density or nnz? What is its size in memory (whos), and are you able to evaluate
B = A.' ;
without generating this out of memory error?
Steffen
2013 年 11 月 5 日
回答 (1 件)
If you only plan to use A*A' in matrix multiplication, you might be able to use my ProdCascade class
>> A=sprand(4e6, 1e6,1e-5); c=rand(4e6,1);
>> tic; B=A*A'; B*c; toc;
Out of memory. Type HELP MEMORY for your options.
>> tic; B=ProdCascade({A,A.'}); B*c; toc;
Elapsed time is 7.531522 seconds.
8 件のコメント
Steffen
2013 年 11 月 6 日
Matt J
2013 年 11 月 6 日
True, but why calculate C*D*D.'*C.' - Y * Y.' instead of just C*D-Y ?
Steffen
2013 年 11 月 6 日
and do a gradient descent to get a new C. Calculate a new D and E and so on...
No, it should be possible to calculate D and E just by doing
D=C\Y;
E=C\X;
Steffen
2013 年 11 月 6 日
カテゴリ
ヘルプ センター および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!