Registered Member
|
Hi,
i'm using Eigen to calculate eigenvalues of matrices. Currently i use the SelfAdjoinEigenSolver<MatrixXd>. Is there a faster way if the matrix is positive semidefinite and symmetric? Regards, iljah |
Registered Member
|
Yes. Being selfadjoint is what matters, being positive doesn't help any further with eigenvalues computation.
Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list! |
Registered Member
|
But if selfadjoint is what matters, why is your answer yes? I use the SelfAdjoinEigenSolver<MatrixXd> already.
Is there a better way than below, if the the matrix hold these conditions? Calculating on a 4000x4000 took up to 1 hour on my PC.
Regards, Iljah |
Registered Member
|
When you use SelfAdjoinEigenSolver<MatrixXd> you are already telling Eigen to assume the matrix is selfadjoint. There's nothing more you can do to help Eigen.
Your code looks good. There are two possible reasons why it took 1 hour. 1) have you correctly enabled optimization? Like -O2 -msse2. 2) This is a really huge size so cache-friendliness is crucial. In the case of this algorithm, cache-friendliness means block housholder transforms, which we don't do at the moment. So indeed there's no chance that we might have good performance right now on such sizes, for eigensolving. This is on the TODO, probably for Eigen 3.1.
Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list! |
Registered Member
|
Ok the optimizations may cause this. I've never heared about them . Is there an article/doc/ref where I can find out what options (like -O2) are needed?
Thanks a lot, Iljah |
Registered Member
|
Every major compiler is able to do optimizations. Eigen relies heavily on that ability. I dont even know what compiler you are using. If it's MS visual studio, just select the 'release' mode in your project settings, and optionally enable SSE2. If you're using GCC, pass -O2 -DNDEBUG, and optionally -msse2 if you want to enable SSE2 instructions. See: http://eigen.tuxfamily.org/index.php?ti ... er_support
Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list! |
Moderator
|
For your information it takes here 37 seconds to compute for a 4k^2 and floats, so ~1mn for double.
Make sure you compile with -O2 and -DNDEBUG. |
Registered Member
|
Sorry for the late response. Your tip works great.
Is there a significant difference between -O2 and -O3? Regards, Iljah |
Registered users: Bing [Bot], Google [Bot], Sogou [Bot]