source: pacpussensors/trunk/Vislab/lib3dv-1.2.0/lib3dv/eigen/doc/snippets/ComplexEigenSolver_compute.cpp

Last change on this file was 136, checked in by ldecherf, 8 years ago

Doc

File size: 792 bytes
Line 
1MatrixXcf A = MatrixXcf::Random(4,4);
2cout << "Here is a random 4x4 matrix, A:" << endl << A << endl << endl;
3
4ComplexEigenSolver<MatrixXcf> ces;
5ces.compute(A);
6cout << "The eigenvalues of A are:" << endl << ces.eigenvalues() << endl;
7cout << "The matrix of eigenvectors, V, is:" << endl << ces.eigenvectors() << endl << endl;
8
9complex<float> lambda = ces.eigenvalues()[0];
10cout << "Consider the first eigenvalue, lambda = " << lambda << endl;
11VectorXcf v = ces.eigenvectors().col(0);
12cout << "If v is the corresponding eigenvector, then lambda * v = " << endl << lambda * v << endl;
13cout << "... and A * v = " << endl << A * v << endl << endl;
14
15cout << "Finally, V * D * V^(-1) = " << endl
16 << ces.eigenvectors() * ces.eigenvalues().asDiagonal() * ces.eigenvectors().inverse() << endl;
Note: See TracBrowser for help on using the repository browser.