Benoit Jacob | f04c1cb | 2008-08-11 21:26:37 +0000 | [diff] [blame^] | 1 | typedef Matrix<float,2,3> Matrix2x3; |
| 2 | typedef Matrix<float,3,2> Matrix3x2; |
| 3 | Matrix2x3 m = Matrix2x3::Random(); |
| 4 | Matrix2f y = Matrix2f::Random(); |
| 5 | cout << "Here is the matrix m:" << endl << m << endl; |
| 6 | cout << "Here is the matrix y:" << endl << y << endl; |
| 7 | Matrix3x2 x; |
| 8 | if(m.lu().solve(y, &x)) |
| 9 | { |
| 10 | assert(y.isApprox(m*x)); |
| 11 | cout << "Here is a solution x to the equation mx=y:" << endl << x << endl; |
| 12 | } |
| 13 | else |
| 14 | cout << "The equation mx=y does not have any solution." << endl; |
| 15 | |