blob: 6eec82169608db95b20b64152ffd37acbbfc44cf [file] [log] [blame]
Jitse Niesenafed0ef2010-05-01 17:52:16 +01001MatrixXcd X = MatrixXcd::Random(4,4);
2MatrixXcd A = X + X.adjoint();
3cout << "Here is a random self-adjoint 4x4 matrix:" << endl << A << endl << endl;
4
5Tridiagonalization<MatrixXcd> triOfA(A);
Jitse Niesen4a5ebcd2010-12-12 13:53:42 +00006MatrixXd T = triOfA.matrixT();
Benoit Jacob26c2afd2010-12-30 04:52:20 -05007cout << "The tridiagonal matrix T is:" << endl << T << endl << endl;
Jitse Niesenafed0ef2010-05-01 17:52:16 +01008
9cout << "We can also extract the diagonals of T directly ..." << endl;
10VectorXd diag = triOfA.diagonal();
11cout << "The diagonal is:" << endl << diag << endl;
12VectorXd subdiag = triOfA.subDiagonal();
13cout << "The subdiagonal is:" << endl << subdiag << endl;