mirror of
https://gitlab.com/libeigen/eigen.git
synced 2024-12-15 07:10:37 +08:00
14 lines
552 B
C++
14 lines
552 B
C++
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);
|
|
MatrixXd T = triOfA.matrixT();
|
|
cout << "The tridiagonal matrix T is:" << endl << T << 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;
|