MATLAB: Calculation of a sparse matrix

matrixsparseurgent

I have a very large matrix, with 3,26,041 rows and columns. I tried doing the simple sparse function for calculating it. But it returns an output as "out of memory" . I have a 64 bit system with 4gb ram. Is there anyway that i can calculate it or do i need a better system ? Can anyone please help, I am new to matlab and hence require urgent help..

Best Answer

Sorry if I am saying what you already know, but the way you have defined A, it is decidedly non-sparse. You should not use the pre-allocation to zeros.
You should initialize the matrix A using the "sparse" command, which will define the indexing into A, without allocating memory for the elements. Then you can fill it in with your loops. Hopefully, there are few enough non-zero elements in the matrix to fit into memory.