Function rgb_derivation::matrix::inversed_copy[][src]

pub fn inversed_copy<K>(matrix: &Matrix<K>) -> Result<Matrix<K>, Error<K>> where
    K: Scalar,
    &'x K: RefNum<K>, 

Returns inversion of a 3✕3 matrix M, i.e. M⁻¹.

Returns an error if the matrix is non-invertible, i.e. if it’s determinant is zero.

Example

let matrix: [[f32; 3]; 3] = [
    [0.488, 0.310, 0.200],
    [0.176, 0.812, 0.010],
    [0.000, 0.010, 0.989],
];
assert_eq!([
    [ 2.3739555,    -0.90051305, -0.4709666],
    [-0.5146161,     1.4268899,   0.08964035],
    [ 0.0052033975, -0.014427602, 1.010216],
], rgb_derivation::matrix::inversed_copy(&matrix).unwrap());