MATLAB: How to find all the eigenvectors of a very large, sparse, symmetric, positive-definite matrix in MATLAB 7.8 (R2009a)

MATLAB

I am trying to get all the eigenvectors and eigenvalues for a very large (22500×22500) sparse, symmetric, positive-definite real matrix A.
I am able to get all the eigenvalues of this matrix using the function EIG. However when I try to find the eigenvectors using EIGS, I run into out of memory problems.
[V D] = eigs(A, 22000);

Best Answer

You are receiving the out of memory error because EIGS tries to return all of the eigenvectors at once and it is not possible to store all the 22500 eigenvectors on a 32-bit machine.
As a workaround, knowledge of the eigenvalues can be used to access the eigenvectors in chunks using the function EIGS as follows:
[V D] = eigs(A,100,0);
The above code will give 100 eigenvectors corresponding to eigenvalues closest to 0. For better results, never use an eigenvalue as the shift (third argument in EIGS).
When retreiving the eirgenvectors, note that although the matrix is sparse the eigenvectors are most likely dense.