Rev | Line | |
---|
[136] | 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 | Tridiagonalization<MatrixXd> triOfA(A);
|
---|
| 14 | MatrixXd Q = triOfA.matrixQ();
|
---|
| 15 | cout << "The orthogonal matrix Q is:" << endl << Q << endl;
|
---|
| 16 | MatrixXd T = triOfA.matrixT();
|
---|
| 17 | cout << "The tridiagonal matrix T is:" << endl << T << endl << endl;
|
---|
| 18 | cout << "Q * T * Q^T = " << endl << Q * T * Q.transpose() << endl;
|
---|
| 19 |
|
---|
| 20 | return 0;
|
---|
| 21 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.