diff options
Diffstat (limited to 'doc/examples/TutorialLinAlgSetThreshold.cpp')
-rw-r--r-- | doc/examples/TutorialLinAlgSetThreshold.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/doc/examples/TutorialLinAlgSetThreshold.cpp b/doc/examples/TutorialLinAlgSetThreshold.cpp new file mode 100644 index 000000000..e0927cf27 --- /dev/null +++ b/doc/examples/TutorialLinAlgSetThreshold.cpp @@ -0,0 +1,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; +} |