MCPcopy Create free account
hub / github.com/numpy/numpy / pinv

Function pinv

numpy/array_api/linalg.py:247–262  ·  view source on GitHub ↗

Array API compatible wrapper for :py:func:`np.linalg.pinv `. See its docstring for more information.

(x: Array, /, *, rtol: Optional[Union[float, Array]] = None)

Source from the content-addressed store, hash-verified

245
246# Note: the keyword argument name rtol is different from np.linalg.pinv
247def pinv(x: Array, /, *, rtol: Optional[Union[float, Array]] = None) -> Array:
248 """
249 Array API compatible wrapper for :py:func:`np.linalg.pinv <numpy.linalg.pinv>`.
250
251 See its docstring for more information.
252 """
253 # Note: the restriction to floating-point dtypes only is different from
254 # np.linalg.pinv.
255 if x.dtype not in _floating_dtypes:
256 raise TypeError('Only floating-point dtypes are allowed in pinv')
257
258 # Note: this is different from np.linalg.pinv, which does not multiply the
259 # default tolerance by max(M, N).
260 if rtol is None:
261 rtol = max(x.shape[-2:]) * np.finfo(x.dtype).eps
262 return Array._new(np.linalg.pinv(x._array, rcond=rtol))
263
264def qr(x: Array, /, *, mode: Literal['reduced', 'complete'] = 'reduced') -> QRResult:
265 """

Callers

nothing calls this directly

Calls 2

_newMethod · 0.80
maxFunction · 0.70

Tested by

no test coverage detected