Benoit Jacob | ab5cc82 | 2009-09-22 20:58:29 -0400 | [diff] [blame^] | 1 | Matrix<float,2,3> m = Matrix<float,2,3>::Random(); |
Benoit Jacob | f04c1cb | 2008-08-11 21:26:37 +0000 | [diff] [blame] | 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; |
Benoit Jacob | ab5cc82 | 2009-09-22 20:58:29 -0400 | [diff] [blame^] | 5 | Matrix<float,3,2> x = m.lu().solve(y); |
| 6 | if((m*x).isApprox(y)) |
Benoit Jacob | f04c1cb | 2008-08-11 21:26:37 +0000 | [diff] [blame] | 7 | { |
Benoit Jacob | f04c1cb | 2008-08-11 21:26:37 +0000 | [diff] [blame] | 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 | |