aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc/snippets/Tridiagonalization_diagonal.cpp
blob: 30ce77d13b994f73033d9c82d0fdc782c5da3d7a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
MatrixXcd X = MatrixXcd::Random(4,4);
MatrixXcd A = X + X.adjoint();
cout << "Here is a random self-adjoint 4x4 matrix:" << endl << A << endl << endl;

Tridiagonalization<MatrixXcd> triOfA(A);
MatrixXcd T = triOfA.matrixT();
cout << "The tridiagonal matrix T is:" << endl << triOfA.matrixT() << endl << endl;

cout << "We can also extract the diagonals of T directly ..." << endl;
VectorXd diag = triOfA.diagonal();
cout << "The diagonal is:" << endl << diag << endl; 
VectorXd subdiag = triOfA.subDiagonal();
cout << "The subdiagonal is:" << endl << subdiag << endl;