numpy.linalg.pinv

numpy.linalg.pinv(a, rcond=1.0000000000000001e-15)

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.

Parameters:

a : array_like (M, N)

Matrix to be pseudo-inverted.

rcond : float

Cutoff for small singular values. Singular values smaller than rcond*largest_singular_value are considered zero.

Returns:

B : ndarray (N, M)

The pseudo-inverse of a. If a is an np.matrix instance, then so is B.

Raises:

LinAlgError :

In case SVD computation does not converge.

Examples

>>> a = np.random.randn(9, 6)
>>> B = np.linalg.pinv(a)
>>> np.allclose(a, np.dot(a, np.dot(B, a)))
True
>>> np.allclose(B, np.dot(B, np.dot(a, B)))
True

Previous topic

numpy.linalg.inv

Next topic

numpy.linalg.tensorinv

This Page

Quick search