pinv#
- class saiunit.linalg.pinv(a, rtol=None, hermitian=False, *, rcond=None, **kwargs)#
Compute the Moore-Penrose pseudo-inverse of a matrix.
SaiUnit implementation of
numpy.linalg.pinv().The resulting unit is
a.unit ** -1.- Parameters:
a (
Array|ndarray|bool|number|bool|int|float|complex| saiunit.Quantity) – Input matrix of shape(..., M, N)to pseudo-invert.rtol (
Array|ndarray|bool|number|bool|int|float|complex|None) – Cutoff for small singular values of shapea.shape[:-2]. Singular values smaller thanrtol * largest_singular_valueare treated as zero. The default is determined based on the floating point precision of the dtype.hermitian (
bool) – IfTrue, the input is assumed to be Hermitian, and a more efficient algorithm is used (default:False).rcond (
Array|ndarray|bool|number|bool|int|float|complex|None) – Deprecated alias forrtol. Will result in aDeprecationWarningif used.
- Returns:
out – Pseudo-inverse of shape
(..., N, M). The resulting unit isa.unit ** -1.- Return type:
Array|ndarray|bool|number|bool|int|float|complex| saiunit.Quantity
See also
saiunit.linalg.invCompute the inverse of a square matrix.
saiunit.linalg.lstsqLeast-squares solution to a linear equation.
Examples
>>> import saiunit as u >>> import jax.numpy as jnp >>> a = jnp.array([[1, 2], ... [3, 4], ... [5, 6]]) * u.second >>> a_pinv = u.linalg.pinv(a) >>> a_pinv.shape (2, 3) >>> u.math.allclose(a_pinv @ a, jnp.eye(2), atol=1e-4) Array(True, dtype=bool)