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 provide xp.linalg.lstsq (e.g., JAX, PyTorch) are used natively; others fall back to NumPy with a ColourRuntimeWarning.

Parameters:
Returns:

Least-squares solution.

Return type:

object