#include #include using namespace Eigen; using namespace std; int main(int, char**) { cout.precision(3); MatrixXd X = MatrixXd::Random(5,5); MatrixXd A = X * X.transpose(); X = MatrixXd::Random(5,5); MatrixXd B = X * X.transpose(); GeneralizedSelfAdjointEigenSolver es(A,B,EigenvaluesOnly); cout << "The eigenvalues of the pencil (A,B) are:" << endl << es.eigenvalues() << endl; es.compute(B,A,false); cout << "The eigenvalues of the pencil (B,A) are:" << endl << es.eigenvalues() << endl; return 0; }