COSC-4P80-Assignment-2/lib/eigen-3.4.0/doc/snippets/SelfAdjointEigenSolver_Self...

8 lines
362 B
C++
Raw Permalink Normal View History

2024-10-21 16:42:03 -04:00
SelfAdjointEigenSolver<Matrix4f> es;
Matrix4f X = Matrix4f::Random(4,4);
Matrix4f A = X + X.transpose();
es.compute(A);
cout << "The eigenvalues of A are: " << es.eigenvalues().transpose() << endl;
es.compute(A + Matrix4f::Identity(4,4)); // re-use es to compute eigenvalues of A+I
cout << "The eigenvalues of A+I are: " << es.eigenvalues().transpose() << endl;