xref: /aosp_15_r20/external/eigen/doc/snippets/Tridiagonalization_compute.cpp (revision bf2c37156dfe67e5dfebd6d394bad8b2ab5804d4)
1*bf2c3715SXin Li Tridiagonalization<MatrixXf> tri;
2*bf2c3715SXin Li MatrixXf X = MatrixXf::Random(4,4);
3*bf2c3715SXin Li MatrixXf A = X + X.transpose();
4*bf2c3715SXin Li tri.compute(A);
5*bf2c3715SXin Li cout << "The matrix T in the tridiagonal decomposition of A is: " << endl;
6*bf2c3715SXin Li cout << tri.matrixT() << endl;
7*bf2c3715SXin Li tri.compute(2*A); // re-use tri to compute eigenvalues of 2A
8*bf2c3715SXin Li cout << "The matrix T in the tridiagonal decomposition of 2A is: " << endl;
9*bf2c3715SXin Li cout << tri.matrixT() << endl;
10