xref: /aosp_15_r20/external/eigen/doc/snippets/FullPivLU_solve.cpp (revision bf2c37156dfe67e5dfebd6d394bad8b2ab5804d4)
1 Matrix<float,2,3> m = Matrix<float,2,3>::Random();
2 Matrix2f y = Matrix2f::Random();
3 cout << "Here is the matrix m:" << endl << m << endl;
4 cout << "Here is the matrix y:" << endl << y << endl;
5 Matrix<float,3,2> x = m.fullPivLu().solve(y);
6 if((m*x).isApprox(y))
7 {
8   cout << "Here is a solution x to the equation mx=y:" << endl << x << endl;
9 }
10 else
11   cout << "The equation mx=y does not have any solution." << endl;
12