SelfAdjointEigenSolver<MatrixXf> es(4); | |
MatrixXf X = MatrixXf::Random(4, 4); | |
MatrixXf A = X + X.transpose(); | |
es.compute(A); | |
cout << "The eigenvalues of A are: " << es.eigenvalues().transpose() << endl; | |
es.compute(A + MatrixXf::Identity(4, 4)); // re-use es to compute eigenvalues of A+I | |
cout << "The eigenvalues of A+I are: " << es.eigenvalues().transpose() << endl; |