eigen/doc/snippets/Tridiagonalization_decomposeInPlace.cpp
Rohit Goswami 6f9bffe8dd DOC: Update documentation for 3.4.x
(cherry picked from commit b0eded878d5d162d61583a286c0d8a45406ad1bc)
2023-07-10 14:52:08 -07:00

13 lines
584 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);
VectorXd hcoeffs(4); // Scratch space for householder reflector.
VectorXd workspace(5);
internal::tridiagonalization_inplace(A, diag, subdiag, hcoeffs, workspace, true);
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;