I want to know how do we solve the problem on out of memory. I'm using Matlab R14, and I want to work around a 70000x70000 sparse matrix. How do I solve this out of memory issue whenever I input numbers?
In addition to the solutions E. Fiorenza proposed, it might be possible to make the code more efficient in terms of memory use. For example, do you use any for loops when working with the matrix? If so, you should replace these loops with matrix operations (if possible). Maybe you could give some more information on the kind of computations you are performing?
The matrix operations I perform are for loops, and I want to replace each element in a column to its corresponding column number. I'm doing matrix operations, it outputs memory error still.
If you just want to replace each element with its column number, you could do it without for loops - this is more efficient in terms of memory use. What about this solution? ->
tic
matrixDim = 70000; % matrix dimensions
yourMatrix = rand(matrixDim); % create random matrix
Hi Jacob, then you will have to follow these instructions, as E. Fiorenza pointed out: http://de.mathworks.com/help/matlab/matlab_prog/resolving-out-of-memory-errors.html
Well, first of all, use an sparse matrix (not a matrix with zeros), get the columns with not null elements using the find command and create a new sparse matrix from these values:
a = sprand(70000,70000,0.1);
[row,col] = find(a > 0);
b = sparse(row,col,col);
Instead 0.1 use any other factor (actually, 0.1 is not very sparse)