You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
401 B

  1. #include <Eigen/Core>
  2. #include <Eigen/LU>
  3. #include <iostream>
  4. using namespace std;
  5. using namespace Eigen;
  6. int main()
  7. {
  8. Matrix3f A;
  9. Vector3f b;
  10. A << 1,2,3, 4,5,6, 7,8,10;
  11. b << 3, 3, 4;
  12. cout << "Here is the matrix A:" << endl << A << endl;
  13. cout << "Here is the vector b:" << endl << b << endl;
  14. Vector3f x = A.lu().solve(b);
  15. cout << "The solution is:" << endl << x << endl;
  16. }