Eigfact and eigen in R seems does not match


In the process of converting some R code to Julia, i found the matrix Eigen decomposition produce different result compared to R. the following code is tested in Julia 0.6, and R 3.3.3 through RCall 0.8.1

using RCall

the R eigenvalues are in descending order, but they are the same as in Julia. however, some of the corresponding eigenvectors are different.


They seem to be identical up to a minus sign in the value eigenvector of the smallest eigenvalue. Should be fairly simple to find out which of them two signs is correct.


Both signs are correct. An eigenvector multiplied by any (nonzero) scalar is still an eigenvector.

For real-symmetric matrices, the usual convention is to return real orthonormal eigenvectors, but you can multiply by ±1 without changing the unit-length normalization. Which sign it picks is fairly random as far as I know.


Sorry, temporary brain malfunction :wink: - I briefly thought changing the sign of the eigenvector would flip the sign of the eigenvalue, but this is of course not the case.


@babaq what is the ultimate goal of the computation? @stevengj is 100% correct, the signs shouldn’t matter if you are trying to project onto the basis or do common operations with the vectors.


as @stevengj explained, i realized that the sign difference doesn’t matter in the context of Eigen factorization, as it’s showed that both factorization is correct. it did show that Julia and R code has some difference of choosing the signs.