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) is associtaed with the x direction, while the last element matrix 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.
using namespace std;
using namespace Eigen;
A << 1, 0, -1, 0, 2, 0, -1, 0, 3;
cout << "Here is the matrix A:\n" << A << endl;
//SelfAdjointEigenSolver<Matrix3f> eigensolver(A); // this changes the order
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,
Este correo puede carecer de tildes o eñes debido al teclado.