colour.algebra.least_square_mapping_MoorePenrose

colour.algebra.least_square_mapping_MoorePenrose(y, x)[source]

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

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

  • x (array_like, optional) – Independent \(x\) variable(s) values corresponding with \(y\) variable.

Returns

Least-squares mapping.

Return type

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...]])