TutorialLinAlgSetThreshold.cpp 377 B

12345678910111213141516
  1. #include <iostream>
  2. #include <Eigen/Dense>
  3. using namespace std;
  4. using namespace Eigen;
  5. int main()
  6. {
  7. Matrix2d A;
  8. A << 2, 1,
  9. 2, 0.9999999999;
  10. FullPivLU<Matrix2d> lu(A);
  11. cout << "By default, the rank of A is found to be " << lu.rank() << endl;
  12. lu.setThreshold(1e-5);
  13. cout << "With threshold 1e-5, the rank of A is found to be " << lu.rank() << endl;
  14. }