Registered Member
|
Hi all,
I'm using c++ eigen library to calculate a eigenvalues and eigenvector for a given matrix.I'm using "SelfAdjointEigenSolver" to compute the eigenvalues and eigenvector. Everything is working fine except when I compare the result with matlab result.It seems like the result computed from eigen library is different with the matlab result.Below is the given matrix and results from eigen library and matlab: Matrix for testing: 39.305, -0.1304, 0, -1.03752, -0.1304, 1.03383, 0, 0.10074, 0, 0, 0, 0, -1.03752, 0.10074, 0, 0.06189; Eigenvector result from c++ eigen library: 0, -0.0259638, 0.0059925, 0.999645, 0, 0.0960162, 0.995374, -0.00347307, -1, 0, -0, 0, 0, -0.995041, 0.095892, -0.026419, Result from matlab: -0.0000 -0.0260 0.0060 -0.9996 0.0000 0.0960 0.9954 0.0035 1.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.9950 0.0959 0.0264 I noticed all the matrix's values are match except the sign.Can anyone help me and give me some hint why this happen. Thank you so much. |
Registered Member
|
This has to do with the definition of an eigenvector. We say that v is an eigenvector, with eigenvalue t, if A * v = t * v. It follows that if v is an eigenvector then -v is also an eigenvector, with the same eigenvalue. In fact, any multiple of v, for instance 2v, is also an eigenvector. So there is no reason to expect that Eigen and Matlab give precisely the same eigenvectors.
|
Registered users: Bing [Bot], claydoh, Google [Bot], rblackwell, Yahoo [Bot]