EigenSolver_EigenSolver_MatrixType.cpp
Go to the documentation of this file.
00001 MatrixXd A = MatrixXd::Random(6,6);
00002 cout << "Here is a random 6x6 matrix, A:" << endl << A << endl << endl;
00003 
00004 EigenSolver<MatrixXd> es(A);
00005 cout << "The eigenvalues of A are:" << endl << es.eigenvalues() << endl;
00006 cout << "The matrix of eigenvectors, V, is:" << endl << es.eigenvectors() << endl << endl;
00007 
00008 complex<double> lambda = es.eigenvalues()[0];
00009 cout << "Consider the first eigenvalue, lambda = " << lambda << endl;
00010 VectorXcd v = es.eigenvectors().col(0);
00011 cout << "If v is the corresponding eigenvector, then lambda * v = " << endl << lambda * v << endl;
00012 cout << "... and A * v = " << endl << A.cast<complex<double> >() * v << endl << endl;
00013 
00014 MatrixXcd D = es.eigenvalues().asDiagonal();
00015 MatrixXcd V = es.eigenvectors();
00016 cout << "Finally, V * D * V^(-1) = " << endl << V * D * V.inverse() << endl;


re_vision
Author(s): Dorian Galvez-Lopez
autogenerated on Sun Jan 5 2014 11:31:07