Is there any faster way to calculate Eigenvalues in C++?

223 Views Asked by At

I have to solve for Eigenvalues from Sparse Matrices that are millions*millions at least and can get even bigger!! The problem is that I am getting very slow results even when I solve for 10 smallest eigenvalues from 20000x20000 matrix using the Eigen and Spectra Libraries, I get results after 15 minutes. If I further increase the size of these matrices, for instance 30000x30000, then it takes more than half an hour to execute. The code is as follows:

SparseSymMatProd<double> eig1(sparsek);
SparseCholesky<double> eig2(sparsem);

SymGEigsSolver <SparseSymMatProd<double>, SparseCholesky<double>,GEigsMode::Cholesky> eigs(eig1,eig2,10,500);

eigs.init();
int nconv = eigs.compute(SortRule::SmallestMagn);

VectorXd evalues;
MatrixXd evecs;
if (eigs.info() == CompInfo::Successful)
{
    evalues = eigs.eigenvalues();
    evecs = eigs.eigenvectors();
}
cout << "Generalized Eigenvalues found: \n" << evalues << endl;
cout << "Generalized Eigenvectors found: \n" << evecs.bottomRows(10) << endl;

Where sparsek and sparsem are Stiffness and Mass Matrices calculated for a 1 dimensional bar.

0

There are 0 best solutions below