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(4,4);
|
---|
11 | MatrixXd A = X * X.transpose();
|
---|
12 | cout << "Here is a random positive-definite matrix, A:" << endl << A << endl << endl;
|
---|
13 |
|
---|
14 | SelfAdjointEigenSolver<MatrixXd> es(A);
|
---|
15 | cout << "The inverse square root of A is: " << endl;
|
---|
16 | cout << es.operatorInverseSqrt() << endl;
|
---|
17 | cout << "We can also compute it with operatorSqrt() and inverse(). That yields: " << endl;
|
---|
18 | cout << es.operatorSqrt().inverse() << endl;
|
---|
19 |
|
---|
20 | return 0;
|
---|
21 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.