Math module

inverse_gaussian_elimination

procedure · 1 overloadSource

Inverts a Matrix4 by Gauss-Jordan elimination with partial pivoting, returning (success, result). Fails only when a pivot is exactly zero (singular), giving the identity as result. Nearly singular matrices succeed with a large error.

ExampleOpen in playground ↗
t := make_translation_matrix4(xyz(1, 2, 3));
ok, inv := inverse_gaussian_elimination(t);
assert(ok && inv * t == Matrix4_Identity);
inverse_gaussian_elimination :: (m: Matrix4) -> (success: bool, result: Matrix4)

The inverse by Gauss-Jordan elimination with row pivoting. False and the identity when there is none.

Parameters

m: Matrix4
the matrix.

Returns

success: bool
result: Matrix4

See also