2010-06-30 22:11:55 +08:00
|
|
|
#include <iostream>
|
|
|
|
#include <Eigen/Dense>
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
using namespace Eigen;
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
Matrix2f A;
|
|
|
|
A << 1, 2, 2, 3;
|
|
|
|
cout << "Here is the matrix A:\n" << A << endl;
|
|
|
|
SelfAdjointEigenSolver<Matrix2f> eigensolver(A);
|
2011-11-02 22:18:20 +08:00
|
|
|
if (eigensolver.info() != Success) abort();
|
2010-06-30 22:11:55 +08:00
|
|
|
cout << "The eigenvalues of A are:\n" << eigensolver.eigenvalues() << endl;
|
2011-11-02 22:18:20 +08:00
|
|
|
cout << "Here's a matrix whose columns are eigenvectors of A \n"
|
2010-06-30 22:11:55 +08:00
|
|
|
<< "corresponding to these eigenvalues:\n"
|
|
|
|
<< eigensolver.eigenvectors() << endl;
|
|
|
|
}
|