aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc/examples/TutorialLinAlgSetThreshold.cpp
blob: e0927cf27a734fec7dff105b47232fe0e89a97fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <iostream>
#include <Eigen/Dense>

using namespace std;
using namespace Eigen;

int main()
{
   Matrix2d A;
   FullPivLU<Matrix2d> lu;
   A << 2, 1,
        2, 0.9999999999;
   lu.compute(A);
   cout << "By default, the rank of A is found to be " << lu.rank() << endl;
   cout << "Now recomputing the LU decomposition with threshold 1e-5" << endl;
   lu.setThreshold(1e-5);
   lu.compute(A);
   cout << "The rank of A is found to be " << lu.rank() << endl;
}