dpnp.linalg.pinv

dpnp.linalg.pinv(a, rcond=1e-15, hermitian=False)[source]

Compute the (Moore-Penrose) pseudo-inverse of a matrix.

Calculate the generalized inverse of a matrix using its singular-value decomposition (SVD) and including all large singular values.

For full documentation refer to numpy.linalg.inv.

Parameters:
  • a ((..., M, N) {dpnp.ndarray, usm_ndarray}) -- Matrix or stack of matrices to be pseudo-inverted.

  • rcond ({float, dpnp.ndarray, usm_ndarray}, optional) -- Cutoff for small singular values. Singular values less than or equal to rcond * largest_singular_value are set to zero. Broadcasts against the stack of matrices. Default: 1e-15.

  • hermitian ({bool}, optional) -- If True, a is assumed to be Hermitian (symmetric if real-valued), enabling a more efficient method for finding singular values. Default: False.

Returns:

out -- The pseudo-inverse of a.

Return type:

(..., N, M) dpnp.ndarray

Examples

The following example checks that a * a+ * a == a and a+ * a * a+ == a+:

>>> import dpnp as np
>>> a = np.random.randn(9, 6)
>>> B = np.linalg.pinv(a)
>>> np.allclose(a, np.dot(a, np.dot(B, a)))
array([ True])
>>> np.allclose(B, np.dot(B, np.dot(a, B)))
array([ True])