Skip to content

Instantly share code, notes, and snippets.

@kohnakagawa
Created April 19, 2014 16:40
Show Gist options
  • Save kohnakagawa/11089815 to your computer and use it in GitHub Desktop.
Save kohnakagawa/11089815 to your computer and use it in GitHub Desktop.
#include <iostream>
#include "Eigen/Core"
#include "Eigen/Eigenvalues"
int main(void){
using namespace Eigen;
Matrix2d A;
Vector2d a;
A << 1,-0.5,-0.5,1;
SelfAdjointEigenSolver<Matrix2d> es(A);
if(es.info() != Success) std::abort();
std::cout << es.eigenvalues() << std::endl;
a = es.eigenvalues();
double temp0 = a(0);
double temp1 = a(1);
std::cout << temp0 << std::endl;
std::cout << temp1 << std::endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment