How to reduce memory for matrix multiplication?

9 visualizzazioni (ultimi 30 giorni)
nilsotto
nilsotto il 23 Mar 2016
Risposto: Walter Roberson il 23 Mar 2016
I guess this is more of a mathematical issue than particually Matlab. I have a matlab app including a huge matrix multiplication that takes up very much memory, which in some cases makes it impossible to run on a common PC. Is there a way to cut the multiplication into smaller pieces in order to reduce required memory.
  1 Commento
Steven Lord
Steven Lord il 23 Mar 2016
Modificato: Steven Lord il 23 Mar 2016
If you describe in more detail the problem you're trying to solve you may receive suggestions on alternate approaches you can use to solve it.
  • How large is your "huge matrix"?
  • Is your matrix stored as a full matrix or a sparse matrix?
  • Is it sparsely populated [few nonzero elements]? This is related to but distinct from the previous question; people sometimes store sparsely populated matrices in full storage or fully nonzero matrices in sparse storage.
  • What data type is it?
  • Do you have access to Parallel Computing Toolbox? If so, do you also have access to MATLAB Distributed Computing Server?
  • Are you using this matrix multiplication to try to solve a system of equations A*x = b by multiplying by the inverse of A? If so, have you tried using the backslash operator and/or an iterative solver like GMRES?
  • What operating system and release of MATLAB are you using? Are they 32-bit or 64-bit?

Accedi per commentare.

Risposte (3)

John D'Errico
John D'Errico il 23 Mar 2016
Modificato: John D'Errico il 23 Mar 2016
How can we answer this question? No, you cannot magically use less memory than you need for a computation. You make the decisions about what it is you want to do, what computations will be done. If they take too much memory, then you may just need to solve smaller problems, or you need to get more memory, or a bigger, faster computer.
One alternative is often that in fact, you really don't need to do that memory intensive computation, that you should in fact be doing it in some other way. But again, how can we answer that question? I cannot read your mind to know what it is that you are doing, and that possibly, you have created some hugely inefficient computation for no good reason. (Don't tell me this could not possibly happen. I've seen it done over and over again, sometimes by people who would have assured me they knew what they were doing.)
If we could make big computations into small ones, just by wanting it to be so, we would live in a very different world, and Harry Potter would be our friend.

nilsotto
nilsotto il 23 Mar 2016
That was indeed a lecture. In my daily work I use Ansys FEA where I can switch between different solvers. By use of disk swapping I can solve very large problems with low amount of memory. If it's as you say not possible to divide large mathematical problems, I wonder how Ansys solvers is working?
  1 Commento
Jan
Jan il 23 Mar 2016
ANSYS produces matrices with a known sparse structure. They can be solved efficiently without performing a full matrix multiplication.

Accedi per commentare.


Walter Roberson
Walter Roberson il 23 Mar 2016
There are techniques for doing large memory multiplications with relatively small memory. The techniques may involve swapping to tape or disk.

Categorie

Scopri di più su Creating and Concatenating Matrices in Help Center e File Exchange

Tag

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by