xref: /aosp_15_r20/external/eigen/doc/snippets/FullPivHouseholderQR_solve.cpp (revision bf2c37156dfe67e5dfebd6d394bad8b2ab5804d4)
1*bf2c3715SXin Li Matrix3f m = Matrix3f::Random();
2*bf2c3715SXin Li Matrix3f y = Matrix3f::Random();
3*bf2c3715SXin Li cout << "Here is the matrix m:" << endl << m << endl;
4*bf2c3715SXin Li cout << "Here is the matrix y:" << endl << y << endl;
5*bf2c3715SXin Li Matrix3f x;
6*bf2c3715SXin Li x = m.fullPivHouseholderQr().solve(y);
7*bf2c3715SXin Li assert(y.isApprox(m*x));
8*bf2c3715SXin Li cout << "Here is a solution x to the equation mx=y:" << endl << x << endl;
9