Registered Member
|
Hi! For sure this is a dumb question, cause I'm a newbie using Eigen, but I can't fix the following:
I try to compute the eigenvalues/vectors of a real symmetric matrix:
I compile in WinXp 32 with mingw: g++ -O2 -DSSE2 -I./eigen2 -o test_eigen.exe test_eigen.cpp The output:
But according to Mr Matlab the correct values are:
Thanks in advance. And great job you Eigen developers, keep up the good work. Cheers!
Last edited by Xupito on Fri Aug 07, 2009 1:53 am, edited 1 time in total.
|
Registered Member
|
I checked with both 2.0 and the development branch: the values found by Eigen are correct.
My best guess is that you made a typo when checking in Matlab. Here's my test program:
Here's the output:
As you can see, the eigenvectors really form a unitary matrix and the product UDU* is really the same as the original matrix, so there's no doubt that the eigenvalues are correct.
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
|
There's a typo in the initialization, you're setting MCV(1,2) twice, which you probably didn't do in MATLAB.
|
Registered Member
|
good catch.
To the OP: next time better use the comma-initializer...
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
|
Thanks a lot bjacob and phr, I should have tried to do the check as you did. I initialized bad the matrix MCV, so as I was afraid, I feel dumber than ever .
|
Registered Member
|
Also it is worth remembering that eigenvectors are not unique, check the eigen condition to verify correctness of a pair of values, eigenvalue & eigen vector respectively.
A * X = lambda * X A is your matrix, X is the eigenvector and lambda is the eigenvalue |
Registered users: Bing [Bot], daret, Google [Bot], sandyvee, Sogou [Bot]