out of memory error while mutiplying large matrices

13 views (last 30 days)
I have got two huge matrices dat1=87093*59 and dat2=99802*59. I tried to do following operation R=dat1*dat1' but MATLAB throws me an error ??? Out of memory. Type HELP MEMORY for your options. I have increased Java Heap Memory(by going into file-<preferences) to 2012Mb but still the problem repeats. Can anyone help me out. system config: windows 7-64bit, 8gb ram, matlab:r2010a-32bit version Many thx in advance.

Accepted Answer

Youssef  Khmou
Youssef Khmou on 7 Apr 2014
This multiplication goes beyond the limit of Read-Only-Memory, the solution is to use the multiplication per blocks, see the example in this link on how this is performed : http://math.stackexchange.com/questions/30135/multiplication-of-block-matrices
So you need to decompose the matrices A,B into at least 4 blocks and compute structurally each block of C.

More Answers (3)

John D'Errico
John D'Errico on 7 Apr 2014
Edited: John D'Errico on 7 Apr 2014
Just wanting to do something extreme is not enough to be able to do it.
The resulting matrix will be 87093x99802 in size,
87093*99802*8/1e9
ans =
69.536
so roughly 70 gigabytes in size.
People think their computers are infinitely large and infinitely fast. Not true. They have limits, and you are trying to go far past those limits here.

Jan
Jan on 7 Apr 2014
Do not increase the Java heap memory only because it contains the term "memory" also. In this case reserving memory for Java increases the problem, because you have less memory for the computations.
On one hand installing much more RAM is the best solution - I'd start at 2*70 GB. Of course this is expensive. On the other hand running a 32-bit version of Matlab is not sufficient.

sriharsha
sriharsha on 8 Apr 2014
hey guys thanks for the replies..I didn't recognize the size of matrix at all..It was utterly my mistake..thought it could be some prob with code or so and completely overlooked my matrix size.. I got it now I will try to get it down. Thanks once again.

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!