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

10 lines
392 B
C++
Raw Normal View History

2024-10-21 16:42:03 -04:00
Tridiagonalization<MatrixXf> tri;
MatrixXf X = MatrixXf::Random(4,4);
MatrixXf A = X + X.transpose();
tri.compute(A);
cout << "The matrix T in the tridiagonal decomposition of A is: " << endl;
cout << tri.matrixT() << endl;
tri.compute(2*A); // re-use tri to compute eigenvalues of 2A
cout << "The matrix T in the tridiagonal decomposition of 2A is: " << endl;
cout << tri.matrixT() << endl;