This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Eigen3 eigenvectors have different signs than Octave's eig()

Tags: None
(comma "," separated)
khughes
Registered Member
Posts
1
Karma
0
Hi there,

I am working on porting code from MatLab/Octave to eigen3 and I am running into the situation where my eigenvectors have different signs than those found using octave. The eigenvalues are the same though.

What is the proper way to get the functionality of Octave's eig() function with eigen3?

Thanks!
jitseniesen
Registered Member
Posts
204
Karma
2
If v is an eigenvector, then -v is also an eigenvector. Some algorithms will return v, some will return -v. It should not matter for the remainder of your computation.

If you want to compare the eigenvectors returned by Octave and Eigen, to make sure they are (approximately) the same, you have to decide on an arbitrary normalization. For instance, you can make the first nonzero coordinate of the eigenvectors positive. Keep in mind that the order of eigenvectors may also vary.


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Sogou [Bot], Yahoo [Bot]