Brian Silverman | 72890c2 | 2015-09-19 14:37:37 -0400 | [diff] [blame] | 1 | MatrixXd X = MatrixXd::Random(5,5); |
| 2 | MatrixXd A = X + X.transpose(); |
| 3 | cout << "Here is a random symmetric 5x5 matrix:" << endl << A << endl << endl; |
| 4 | |
| 5 | VectorXd diag(5); |
| 6 | VectorXd subdiag(4); |
Austin Schuh | c55b017 | 2022-02-20 17:52:35 -0800 | [diff] [blame^] | 7 | VectorXd hcoeffs(4); // Scratch space for householder reflector. |
| 8 | internal::tridiagonalization_inplace(A, diag, subdiag, hcoeffs, true); |
Brian Silverman | 72890c2 | 2015-09-19 14:37:37 -0400 | [diff] [blame] | 9 | cout << "The orthogonal matrix Q is:" << endl << A << endl; |
| 10 | cout << "The diagonal of the tridiagonal matrix T is:" << endl << diag << endl; |
| 11 | cout << "The subdiagonal of the tridiagonal matrix T is:" << endl << subdiag << endl; |