blob: 696f414b3b97db12b1f15af4066d468e9cb247a5 [file] [log] [blame]
Benoit Jacobab5cc822009-09-22 20:58:29 -04001Matrix<float,2,3> m = Matrix<float,2,3>::Random();
Benoit Jacobf04c1cb2008-08-11 21:26:37 +00002Matrix2f y = Matrix2f::Random();
3cout << "Here is the matrix m:" << endl << m << endl;
4cout << "Here is the matrix y:" << endl << y << endl;
Benoit Jacobe4e58e82009-11-08 16:51:41 -05005Matrix<float,3,2> x = m.fillPivLu().solve(y);
Benoit Jacobab5cc822009-09-22 20:58:29 -04006if((m*x).isApprox(y))
Benoit Jacobf04c1cb2008-08-11 21:26:37 +00007{
Benoit Jacobf04c1cb2008-08-11 21:26:37 +00008 cout << "Here is a solution x to the equation mx=y:" << endl << x << endl;
9}
10else
11 cout << "The equation mx=y does not have any solution." << endl;