colour.utilities.xp_lstsq#
- colour.utilities.xp_lstsq(a: ArrayLike, b: ArrayLike, *, rcond: float | None = None, xp: ProtocolArrayNamespace | ModuleType | None = None) NDArrayFloat[source]#
Array API compatible implementation of
numpy.linalg.lstsq().Returns only the least-squares solution (the first element of the tuple returned by
numpy.linalg.lstsq()). Backends that providexp.linalg.lstsq(e.g., JAX, PyTorch) are used natively; others fall back to NumPy with a ColourRuntimeWarning.- Parameters:
a (ArrayLike) – Coefficient matrix.
b (ArrayLike) – Ordinate values.
rcond (float | None) – Cut-off ratio for small singular values (passed to NumPy only).
xp (ProtocolArrayNamespace | ModuleType | None) – Array namespace module. If None, derived from
aandb.
- Returns:
Least-squares solution.
- Return type: