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

Parameters :

a : array_like, shape (M, N)

Matrix to be pseudo-inverted.

rcond : float

Cutoff for small singular values.
Singular values smaller (in modulus) than
rcond * largest_singular_value (again, in modulus)
are set to zero.

Returns :

B : ndarray, shape (N, M)

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

Raises :

LinAlgError :

If the SVD computation does not converge.

Notes

The pseudo-inverse of a matrix A, denoted , is
defined as: “the matrix that ‘solves’ [the least-squares problem]
,” i.e., if is said solution, then
is that matrix such that .

It can be shown that if is the singular
value decomposition of A, then
, where are
orthogonal matrices, is a diagonal matrix consisting
of A’s so-called singular values, (followed, typically, by
zeros), and then is simply the diagonal matrix
consisting of the reciprocals of A’s singular values
(again, followed by zeros). [R39]