Search code examples
matlabsparse-matrixeigenvalue

Eigenvalue decomposition using MATLAB


I'm conducting dimensional reduction of a square matrix A. My issue now is that I have problem computing eigvalue decomposition of a 13000 x 13000 matrix A, i.e. [v d]=eigs(A). Because it's a sparse matrix, I get 'out of memory error' using a 4GB RAM. I'm convinced it's not my PC's problem, since the memory is not used up when eigs command is run. The help I saw online had to do with ARPACK. I checked the recommended site, but there were a lot of files there, don't know which to download. Also, I did not understand how to use it with MATLAB. Another help says use numerical methods, but I dont know which specific one to use. Please any solution is welcome.

Error in ==> eigs>ishermitian at 1535
tf = isequal(A,A');

Error in ==> eigs>checkInputs at 479
            issymA = ishermitian(A);

Error in ==> eigs at 96
[A,Amatrix,isrealprob,issymA,n,B,classAB,k,eigs_sigma,whch, ...

Error in ==> labcomp at 20
[vector lambda] = eigs(A) 

Please can I get translation of these errors and how to correct it?


Solution

  • The reason you don't see the memory used up, is that it isn't used up - Matlab fails to allocate the needed amount of memory.

    Although an array of 13000 x 13000 doubles (the default data type in Matlab) is about 1.25 GB, it doesn't mean a 4Gb of ram is enough - Matlab need 1.25Gb of contiguous memory, otherwise it won't succeed in allocating your matrix. You can read more on memory problems in Matlab here: http://www.mathworks.com/support/tech-notes/1100/1106.html

    You can as a first step try using single precision:

    [v d]=eigs(single(A));
    

    You say

    another help says use numerical methods

    If you are doing it on the computer, it's numerical by definition.

    If you dont' want (or can't due to memory constraints) to do it in Matlab, you can look for a linear algebra library (ARPACK is just one of them) and have the calculation done outside of Matlab.