[eigen] Is there any guarantee regaridng the order of the eigenvalues for the EigenSolver?

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


Dear all,
I am performing some simulations where I need to compute the eigenvalues of the stress tensor of the 3D  system, represented by a 3x3 matrix. The way the matrix is constructed implies that, for example, the first value (matrix[0][0]) is associtaed with the x direction, while the last element matrix[2][2] is associated with the z direction. In the same way, it is expected, for example, that the last eigen value will be associtaed with the z direction.  The matrix is Self Adjoint.
I would like to know if there is a guaranteed that the latest eigenvalue returned by eigensolver.eigenvalues() will always correspond to the same eigenvector, or if the eigensolver will return the eigen values permuted in some way. I have just tested (see code at the end) with some random matrices and diagonal matrices and it seems that I always get the same ordering, but if I use the SelfAdjoint solver then the order changes. If I repeat the computation with the general or the SelfAdjoint version I get the same output for each method, although the ordering differes between them. 
I need to confirm the ordegring, since I need to perform some computations which depends strongly on the relative value of the first eigen value (x value) compared with the latest one (z value).
Thanks in advance. 
#include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
  Matrix3f A;
  A << 1, 0, -1, 0, 2, 0, -1, 0, 3;
  cout << "Here is the matrix A:\n" << A << endl;
  EigenSolver<Matrix3f> eigensolver(A);
  //SelfAdjointEigenSolver<Matrix3f> eigensolver(A); // this changes the order
  if (eigensolver.info() != Success) abort();
  cout << "The eigenvalues of A are:\n" << eigensolver.eigenvalues() << endl;
  cout << "Here's a matrix whose columns are eigenvectors of A \n"
       << "corresponding to these eigenvalues:\n"
       << eigensolver..eigenvectors() << endl;
}


--

Best regards / Cordialmente,

William-Fernando Oquendo
--------------------------
Este correo puede carecer de tildes o eñes debido al teclado. 



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/