Line | |
---|
1 | #include <Eigen/Dense>
|
---|
2 | #include <iostream>
|
---|
3 |
|
---|
4 | using namespace Eigen;
|
---|
5 | using namespace std;
|
---|
6 |
|
---|
7 | int main(int, char**)
|
---|
8 | {
|
---|
9 | cout.precision(3);
|
---|
10 | MatrixXd X = MatrixXd::Random(5,5);
|
---|
11 | MatrixXd A = X + X.transpose();
|
---|
12 | cout << "Here is a random symmetric 5x5 matrix:" << endl << A << endl << endl;
|
---|
13 |
|
---|
14 | VectorXd diag(5);
|
---|
15 | VectorXd subdiag(4);
|
---|
16 | internal::tridiagonalization_inplace(A, diag, subdiag, true);
|
---|
17 | cout << "The orthogonal matrix Q is:" << endl << A << endl;
|
---|
18 | cout << "The diagonal of the tridiagonal matrix T is:" << endl << diag << endl;
|
---|
19 | cout << "The subdiagonal of the tridiagonal matrix T is:" << endl << subdiag << endl;
|
---|
20 |
|
---|
21 | return 0;
|
---|
22 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.