问题
i'm trying to get a limited number of eigen-values with smallest magnitude of a squared symmetric matrix. To do this, i'm using first the example in the doc of Armadillo (http://arma.sourceforge.net/docs.html#eigs_sym) :
sp_mat A = sprandu<sp_mat>(1000, 1000, 0.1);
sp_mat B = A.t()*A;
arma::vec eigval;
mat eigvec;
eigs_sym(eigval, eigvec, B, 10, "sm");//i add "sm" to get the eigen-
//values of smallest magnitude
cout<<eigval<<endl;
Here i obtain an error saying the ddcomposition fails [failed to converge].
However, when i called eigs_sym like this:
eigs_sym(eigval, eigvec, B, 10); //obtain the eigen-values with
//LARGEST magnitude (default call)
this work well and i get the expected result:
1.1596e+02
1.1680e+02
1.1785e+02
1.1815e+02
1.1927e+02
1.2017e+02
1.2108e+02
1.2256e+02
1.2323e+02
2.5413e+03
i'm on Ubuntu Os, and here is my .pro file (Qt) :
LIBS += -lgsl -lgslcblas -lX11 -lpthread -llapack -lm -fopenmp
-larmadillo
Any idea for resolving this issue?
Thank you
回答1:
I solved this issure by choosing a higher number of eigenvalues to extract. Apparently, a lower number of eigenvalues to extract makes the eigensolver to note converge. If you replace
eigs_sym(eigval, eigvec, B, 10,"sm")
by
eigs_sym(eigval, eigvec, B, 100,"sm")
this will work.
来源:https://stackoverflow.com/questions/36059755/issue-with-eigs-sym-for-obtaining-eigenvalues-with-smallest-magnitude