13 #include <Eigen/Dense>
14 #include <Eigen/Eigenvalues>
35 Eigen::EigenSolver< EigenMatrix > solver(a,
true);
38 if( solver.info() != Eigen::ComputationInfo::Success )
45 ad = solver.eigenvalues().real();
46 u = solver.eigenvectors().real();
65 std::vector< size_t > sorted_indices;
66 sorted_indices.push_back(0);
67 for(
int i = 1; i < 3; i++)
70 auto it = sorted_indices.begin();
71 for(; it != sorted_indices.end(); ++it)
73 if(std::abs(ad(*it)) < std::abs(ad(i)))
78 sorted_indices.insert(it, i);
85 for(
int i = 0; i < 3; i++)
87 sorted_eigen_val(i) = ad(sorted_indices[i]);
88 sorted_eigen_vect.col(i) = u.col(sorted_indices[i]);
91 ad = sorted_eigen_val;
92 u = sorted_eigen_vect;