source: pacpussensors/trunk/Vislab/lib3dv-1.2.0/lib3dv/eigen/doc/snippets/class_FullPivLU.cpp

Last change on this file was 136, checked in by ldecherf, 8 years ago

Doc

File size: 732 bytes
Line 
1typedef Matrix<double, 5, 3> Matrix5x3;
2typedef Matrix<double, 5, 5> Matrix5x5;
3Matrix5x3 m = Matrix5x3::Random();
4cout << "Here is the matrix m:" << endl << m << endl;
5Eigen::FullPivLU<Matrix5x3> lu(m);
6cout << "Here is, up to permutations, its LU decomposition matrix:"
7 << endl << lu.matrixLU() << endl;
8cout << "Here is the L part:" << endl;
9Matrix5x5 l = Matrix5x5::Identity();
10l.block<5,3>(0,0).triangularView<StrictlyLower>() = lu.matrixLU();
11cout << l << endl;
12cout << "Here is the U part:" << endl;
13Matrix5x3 u = lu.matrixLU().triangularView<Upper>();
14cout << u << endl;
15cout << "Let us now reconstruct the original matrix m:" << endl;
16cout << lu.permutationP().inverse() * l * u * lu.permutationQ().inverse() << endl;
Note: See TracBrowser for help on using the repository browser.