mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-04-20 08:39:37 +08:00
11 lines
479 B
C++
11 lines
479 B
C++
MatrixXd X = MatrixXd::Random(5,5);
|
|
MatrixXd A = X + X.transpose();
|
|
cout << "Here is a random symmetric 5x5 matrix:" << endl << A << endl << endl;
|
|
|
|
VectorXd diag(5);
|
|
VectorXd subdiag(4);
|
|
Tridiagonalization<MatrixXd>::decomposeInPlace(A, diag, subdiag);
|
|
cout << "The orthogonal matrix Q is:" << endl << A << endl;
|
|
cout << "The diagonal of the tridiagonal matrix T is:" << endl << diag << endl;
|
|
cout << "The subdiagonal of the tridiagonal matrix T is:" << endl << subdiag << endl;
|