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!