issue with eigs_sym for obtaining eigenvalues with smallest magnitude

社会主义新天地 提交于 2019-12-12 04:11:22

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!