Files
eigen/doc/snippets/Tridiagonalization_compute.cpp
T
2026-05-04 00:36:12 +00:00

13 lines
477 B
C++

// SPDX-FileCopyrightText: The Eigen Authors
// SPDX-License-Identifier: MPL-2.0
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); // reuse tri to compute eigenvalues of 2A
cout << "The matrix T in the tridiagonal decomposition of 2A is: " << endl;
cout << tri.matrixT() << endl;