compile_class_FullPivLU.cpp
Go to the documentation of this file.
00001 #include <Eigen/Core>
00002 #include <Eigen/LU>
00003 #include <Eigen/QR>
00004 #include <Eigen/Cholesky>
00005 #include <Eigen/Geometry>
00006 #include <Eigen/Jacobi>
00007 #include <Eigen/Eigenvalues>
00008 #include <iostream>
00009 
00010 using namespace Eigen;
00011 using namespace std;
00012 
00013 int main(int, char**)
00014 {
00015   cout.precision(3);
00016   typedef Matrix<double, 5, 3> Matrix5x3;
00017 typedef Matrix<double, 5, 5> Matrix5x5;
00018 Matrix5x3 m = Matrix5x3::Random();
00019 cout << "Here is the matrix m:" << endl << m << endl;
00020 Eigen::FullPivLU<Matrix5x3> lu(m);
00021 cout << "Here is, up to permutations, its LU decomposition matrix:"
00022      << endl << lu.matrixLU() << endl;
00023 cout << "Here is the L part:" << endl;
00024 Matrix5x5 l = Matrix5x5::Identity();
00025 l.block<5,3>(0,0).triangularView<StrictlyLower>() = lu.matrixLU();
00026 cout << l << endl;
00027 cout << "Here is the U part:" << endl;
00028 Matrix5x3 u = lu.matrixLU().triangularView<Upper>();
00029 cout << u << endl;
00030 cout << "Let us now reconstruct the original matrix m:" << endl;
00031 cout << lu.permutationP().inverse() * l * u * lu.permutationQ().inverse() << endl;
00032 
00033   return 0;
00034 }


re_vision
Author(s): Dorian Galvez-Lopez
autogenerated on Sun Jan 5 2014 11:30:57