Math module

inverse

procedure · 2 overloadsSource

The inverse of a matrix, returned as (success, result).

ExampleOpen in playground ↗
ok, inv := inverse(Matrix3.{ 2, 0, 0, 0, 4, 0, 0, 0, 5 });
assert(ok && inv._11 == 0.5 && inv._22 == 0.25 && inv._33 == 0.2);

ok4, inv4 := inverse(Matrix4.{});
assert(!ok4 && inv4 == Matrix4_Identity);
inverse :: (a: Matrix3, epsilon := 0.001) -> (success: bool, result: Matrix3)

The inverse, or false and the input back when there is none.

Parameters

a: Matrix3
the matrix.
epsilon := 0.001
a determinant closer to 0 than this counts as having no inverse.

Returns

success: bool
result: Matrix3
inverse :: (m: Matrix4) -> (success: bool, result: Matrix4)

The inverse, or false and the identity when there is none.

Parameters

m: Matrix4
the matrix.

Returns

success: bool
result: Matrix4

See also