bool isConsiderZeroTolerant(T) (T f) nothrow { return (abs(f) < 0.0001f); } Matrix3f a = matrixf( 1, 3, -2, 3, 5, 6, 2, 4, 3 ); Vector3f b = Vector3f(5, 7, 8); Vector3f x = Vector3f(0, 0, 0); solve(a, x, b); assert(isConsiderZeroTolerant(-15 - x[0])); assert(isConsiderZeroTolerant(8 - x[1])); assert(isConsiderZeroTolerant(2 - x[2]));
Solve Ax = b directly using LUP decomposition