colour.algebra.least_square_mapping_MoorePenrose#

colour.algebra.least_square_mapping_MoorePenrose(y: ArrayLike, x: ArrayLike) NDArrayFloat[source]#

Compute the least-squares mapping from dependent variable \(y\) to independent variable \(x\) using Moore-Penrose inverse.

Parameters:
  • y (ArrayLike) – Dependent and already known \(y\) variable.

  • x (ArrayLike) – Independent \(x\) variable(s) values corresponding with \(y\) variable.

Returns:

Least-squares mapping.

Return type:

numpy.ndarray

References

[FMH15]

Examples

>>> prng = np.random.RandomState(2)
>>> y = prng.random_sample((24, 3))
>>> x = y + (prng.random_sample((24, 3)) - 0.5) * 0.5
>>> least_square_mapping_MoorePenrose(y, x)  
array([[ 1.0526376...,  0.1378078..., -0.2276339...],
       [ 0.0739584...,  1.0293994..., -0.1060115...],
       [ 0.0572550..., -0.2052633...,  1.1015194...]])