Registered Member
|
I need to find the largest eigenvalue for a self adjoint matrix. It seems that if I use the following:
SelfAdjointEigenSolver<MatrixXf> es(A, EigenvaluesOnly), the time it takes is much more than MATLAB. I'm wondering what is the fastest way to get the largest eigenvalue in eigen? |
Moderator
|
There is no algorithm in Eigen to compile only the largest one. Regarding the performance, makes sure you compile with the optimizations enabled, Eigen is extremely slow otherwise.
|
Registered Member
|
Thank you, ggael! I'm using g++, and I tried to compile with optimization level O1, O2, O3, they all raise up the speed significantly, O 0 is a little bit slow, but still twice the speed than previously. Do you know what is the optimized way to optimize the parameters? By the way, the speed is still not that fast, I tested over 1000 by 1000 random self adjoint dense matrices 10 times, and it seems that the speed with Eigen is only 3 times the speed of MATLAB if I use the function eig in MATLAB to compute all the eigenvalues. Is it possible to make it even faster? Another question here, if the matrix has some structure, the off diagonal entries are either 1 or p or 0, and are randomly selected, is it possible to make advantage of this special struture? |
Moderator
|
-O2 and if you are running a 32 bits system -msse2 should do the job. But you are right, MatLab uses MKL, and for such large matrices we are still suffering from the lack of block implementation of the tridiagonalization step which is the first step of the eigenvalue decomposition of a selfadjoint matrix, see this bench:http://download.tuxfamily.org/eigen/btl-results-110323/tridiagonalization.pdf
Regarding the special structure, if the there are a lot of 0 (like 80% or more), then a sparse eigenvalue decomposition could be significantly faster. |
Registered Member
|
Hi There,
I do programming in c++ using eigen library. I only need the left eigenvector corresponding the largest eigenvalue of some matrix like 10*10. Is there any fast approach to reach it? Thanks, |
Registered users: bartoloni, Bing [Bot], Evergrowing, Google [Bot]