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.

16 lines
792 B

  1. MatrixXcf A = MatrixXcf::Random(4,4);
  2. cout << "Here is a random 4x4 matrix, A:" << endl << A << endl << endl;
  3. ComplexEigenSolver<MatrixXcf> ces;
  4. ces.compute(A);
  5. cout << "The eigenvalues of A are:" << endl << ces.eigenvalues() << endl;
  6. cout << "The matrix of eigenvectors, V, is:" << endl << ces.eigenvectors() << endl << endl;
  7. complex<float> lambda = ces.eigenvalues()[0];
  8. cout << "Consider the first eigenvalue, lambda = " << lambda << endl;
  9. VectorXcf v = ces.eigenvectors().col(0);
  10. cout << "If v is the corresponding eigenvector, then lambda * v = " << endl << lambda * v << endl;
  11. cout << "... and A * v = " << endl << A * v << endl << endl;
  12. cout << "Finally, V * D * V^(-1) = " << endl
  13. << ces.eigenvectors() * ces.eigenvalues().asDiagonal() * ces.eigenvectors().inverse() << endl;