You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
544 B

  1. #include <iostream>
  2. #include <StormEigen/Dense>
  3. using namespace std;
  4. using namespace StormEigen;
  5. int main()
  6. {
  7. Matrix2f A;
  8. A << 1, 2, 2, 3;
  9. cout << "Here is the matrix A:\n" << A << endl;
  10. SelfAdjointEigenSolver<Matrix2f> eigensolver(A);
  11. if (eigensolver.info() != Success) abort();
  12. cout << "The eigenvalues of A are:\n" << eigensolver.eigenvalues() << endl;
  13. cout << "Here's a matrix whose columns are eigenvectors of A \n"
  14. << "corresponding to these eigenvalues:\n"
  15. << eigensolver.eigenvectors() << endl;
  16. }