Question

I am using LAPACK's ssteqr function to calculate eigenvalues/eigenvectors. The documentation for ssteqr says that the eigenvalues are sorted "in ascending order". Is it reasonable to assume that the list of eigenvectors is also sorted in ascending order?

Was it helpful?

Solution

Yes, it is reasonable to assume that the eigenvectors are ordered so that the i-th eigenvector corresponds to the i-th eigenvalue.

Nevertheless, if I were you, I would check for each eigenvalue the result of the multiplication of the eigenvector by the matrix. This way you are sure that you interpret the output right, and you see explicitly the accuracy of the calculations.

OTHER TIPS

An old question, this, but I struggled with this recently, so am adding this for current and future readers.

The basic answer is that, yes, the eigenvectors are sorted such that the ith eigenvector corresponds to the ith eigenvalue. However, note that the eigenvectors thus obtained may not be the actual eigenvectors you want. This is so because of the following.

Since the ?steqr functions work only on tridiagonal matrices, one typically uses LAPACK's ?sytrd functions to first transform one's original symmetric matrix, call it M, to a tridiagonal form, call it T, such that M = QTQT where Q is an orthogonal matrix (and QT denotes its transpose). One then applies the ?steqr function on this tridiagonal matrix T to find its eigenvalues and eigenvectors. Now the eigenvalues thus obtained (of T) are exactly the same as the eigenvalues of M, so if one only wants the eigenvalues one can stop here. But if one is interested in the eigenvectors, like the OP, then one needs to bear in mind that the eigenvectors of T and M are different. To find the eigenvectors of the original matrix M, one needs to left-multiply the obtained eigenvectors of T by Q. This is very easily done by using the LAPACK functions orgtr or ormtr. See here for a clear explanation: https://software.intel.com/en-us/mkl-developer-reference-fortran-sytrd.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top