gaussianInverse

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

pure @safe nothrow @property
M
gaussianInverse
(
M
)
(
in M mat
)
if ()

Examples

/// 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));

Meta