Say I have a real symmetric matrix, and I want to extract the k largest eigenvectors using eig
.
I know I can use eigs
instead but that's not the point of my question.
I read that they use different algorithms, and the documentation for eigs
states explicitly "largest magnitude", which seems to imply that the eigenvalues would be sorted in absolute value, especially because apparently the sign of the eigenvector/values does not matter.
However I also read that ordering the eigenvectors should be done according to the ranking of the eigenvalues, with sort(diag(D))
; no absolute value here (and no assumption about positiveness for the matrix).
I think that either the latter post is wrong, or Matlab's documentation for
eigs
is wrong or misleading when using the words "largest magnitude", is that right? Or are they both right and I misunderstood something?To clarify then, the "largest" eigenvectors should be sorted according to the absolute eigenvalue, correct?