SelfAdjointEigenSolver_SelfAdjointEigenSolver_MatrixType2.cpp
Go to the documentation of this file.
1 MatrixXd X = MatrixXd::Random(5,5);
2 MatrixXd A = X + X.transpose();
3 cout << "Here is a random symmetric matrix, A:" << endl << A << endl;
4 X = MatrixXd::Random(5,5);
5 MatrixXd B = X * X.transpose();
6 cout << "and a random positive-definite matrix, B:" << endl << B << endl << endl;
7 
8 GeneralizedSelfAdjointEigenSolver<MatrixXd> es(A,B);
9 cout << "The eigenvalues of the pencil (A,B) are:" << endl << es.eigenvalues() << endl;
10 cout << "The matrix of eigenvectors, V, is:" << endl << es.eigenvectors() << endl << endl;
11 
12 double lambda = es.eigenvalues()[0];
13 cout << "Consider the first eigenvalue, lambda = " << lambda << endl;
14 VectorXd v = es.eigenvectors().col(0);
15 cout << "If v is the corresponding eigenvector, then A * v = " << endl << A * v << endl;
16 cout << "... and lambda * B * v = " << endl << lambda * B * v << endl << endl;
Array< int, Dynamic, 1 > v
cout<< "The eigenvalues of A are:"<< endl<< ces.eigenvalues()<< endl;cout<< "The matrix of eigenvectors, V, is:"<< endl<< ces.eigenvectors()<< endl<< endl;complex< float > lambda
MatrixXf B
cout<< "Here is a random symmetric matrix, A:"<< endl<< A<< endl;X=MatrixXd::Random(5, 5);MatrixXd B=X *X.transpose();cout<< "and a random positive-definite matrix, B:"<< endl<< B<< endl<< endl;GeneralizedSelfAdjointEigenSolver< MatrixXd > es(A, B)
Matrix< double, Dynamic, 1 > VectorXd
DynamicĂ—1 vector of type double.
Definition: Matrix.h:502
Matrix< double, Dynamic, Dynamic > MatrixXd
DynamicĂ—Dynamic matrix of type double.
Definition: Matrix.h:502