00001 #include <iostream> 00002 #include <Eigen/Dense> 00003 00004 using namespace std; 00005 using namespace Eigen; 00006 00007 int main() 00008 { 00009 Matrix2f A, b; 00010 A << 2, -1, -1, 3; 00011 b << 1, 2, 3, 1; 00012 cout << "Here is the matrix A:\n" << A << endl; 00013 cout << "Here is the right hand side b:\n" << b << endl; 00014 Matrix2f x = A.ldlt().solve(b); 00015 cout << "The solution is:\n" << x << endl; 00016 }