How can I do a memory efficient sparse matrix multiplication?

10 vues (au cours des 30 derniers jours)
Steffen
Steffen le 5 Nov 2013
Modifié(e) : Matt J le 6 Nov 2013
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 commentaires
Cedric
Cedric le 5 Nov 2013
Modifié(e) : Cedric le 5 Nov 2013
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
Steffen le 5 Nov 2013
16891004 non-zero elements in a 4172241 x 1032306 matrix.
density: 3.921729424555354E-6
Yes, I can calculate B = A.' without generating this error.

Connectez-vous pour commenter.

Réponses (1)

Matt J
Matt J le 5 Nov 2013
Modifié(e) : Matt J le 5 Nov 2013
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 commentaires
Steffen
Steffen le 6 Nov 2013
D=C\Y;
E=C\X;
doesn't work because of memory restrictions. I use the pseudoinverse of C to calculate D and E. I wanted to do the gradient descend to improve the C matrix.
Matt J
Matt J le 6 Nov 2013
Modifié(e) : Matt J le 6 Nov 2013
If C is full rank, then pinv(C)*Y is equivalent to D=C\Y so iterative minimization shouldn't improve anything.
Since C has only 5 columns, I can't imagine memory restrictions being a problem.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by