mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
big huge changes, so i dont remember everything.
* renaming, e.g. LU ---> FullPivLU * split tests framework: more robust, e.g. dont generate empty tests if a number is skipped * make all remaining tests use that splitting, as needed. * Fix 4x4 inversion (see stable branch) * Transform::inverse() and geo_transform test : adapt to new inverse() API, it was also trying to instantiate inverse() for 3x4 matrices. * CMakeLists: more robust regexp to parse the version number * misc fixes in unit tests
This commit is contained in:
20
doc/snippets/class_FullPivLU.cpp
Normal file
20
doc/snippets/class_FullPivLU.cpp
Normal file
@@ -0,0 +1,20 @@
|
||||
typedef Matrix<double, 5, 3> Matrix5x3;
|
||||
typedef Matrix<double, 5, 5> Matrix5x5;
|
||||
Matrix5x3 m = Matrix5x3::Random();
|
||||
cout << "Here is the matrix m:" << endl << m << endl;
|
||||
Eigen::FullPivLU<Matrix5x3> lu(m);
|
||||
cout << "Here is, up to permutations, its LU decomposition matrix:"
|
||||
<< endl << lu.matrixLU() << endl;
|
||||
cout << "Here is the L part:" << endl;
|
||||
Matrix5x5 l = Matrix5x5::Identity();
|
||||
l.block<5,3>(0,0).part<StrictlyLowerTriangular>() = lu.matrixLU();
|
||||
cout << l << endl;
|
||||
cout << "Here is the U part:" << endl;
|
||||
Matrix5x3 u = lu.matrixLU().part<UpperTriangular>();
|
||||
cout << u << endl;
|
||||
cout << "Let us now reconstruct the original matrix m:" << endl;
|
||||
Matrix5x3 x = l * u;
|
||||
Matrix5x3 y;
|
||||
for(int i = 0; i < 5; i++) for(int j = 0; j < 3; j++)
|
||||
y(i, lu.permutationQ()[j]) = x(lu.permutationP()[i], j);
|
||||
cout << y << endl; // should be equal to the original matrix m
|
||||
Reference in New Issue
Block a user