Function gaussianInverse

Compute the inverse of a matrix with Gaussian elimination method. Complexity O(n3).

M gaussianInverse(M) (
  in M mat
) @property
if (isMat!M);

Example

/// Example from https://en.wikipedia.org/wiki/Gaussian_elimination
const m = FMat3(
    2, -1, 0,
    -1, 2, -1,
    0, -1, 2
);
const invM = gaussianInverse(m);

import gfx.math.approx : approxUlp;
assert(approxUlp(invM, FMat3(
    0.75f, 0.5f, 0.25f,
    0.5f,  1f,   0.5f,
    0.25f, 0.5f, 0.75f
)));
assert(approxUlp(gaussianInverse(invM), m));