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?
相关问题
- Different results in eigenvector centrality numpy
- Writing a fast linear system solver in OpenCL C
- How to find the common eigenvectors of two matrice
- I get “lapack.h: No such file or directory” althou
- What is the easiest way to install numpy with LAPA
相关文章
- Numpy seems to produce incorrect eigenvectors
- Error in linking gfortran to LAPACK and BLAS
- Wrapping a LAPACKE function using Cython
- Correct way to point to ATLAS/BLAS/LAPACK librarie
- Computing eigenvectors of a sparse matrix in R
- Installing BLAS on a mac OS X Yosemite
- Is integer multiplication implemented using double
- How to use princomp () function in R when covarian
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.
Yes, it is reasonable to assume that the eigenvectors are ordered so that the
i
-th eigenvector corresponds to thei
-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.