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.

17 lines
381 B

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