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

Function pinv

numpy/linalg/linalg.py:1937–2031  ·  view source on GitHub ↗

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. .. versionchanged:: 1.14 Can now operate on stacks of matrices Parameters

(a, rcond=1e-15, hermitian=False)

Source from the content-addressed store, hash-verified

1935
1936@array_function_dispatch(_pinv_dispatcher)
1937def pinv(a, rcond=1e-15, hermitian=False):
1938 """
1939 Compute the (Moore-Penrose) pseudo-inverse of a matrix.
1940
1941 Calculate the generalized inverse of a matrix using its
1942 singular-value decomposition (SVD) and including all
1943 *large* singular values.
1944
1945 .. versionchanged:: 1.14
1946 Can now operate on stacks of matrices
1947
1948 Parameters
1949 ----------
1950 a : (..., M, N) array_like
1951 Matrix or stack of matrices to be pseudo-inverted.
1952 rcond : (...) array_like of float
1953 Cutoff for small singular values.
1954 Singular values less than or equal to
1955 ``rcond * largest_singular_value`` are set to zero.
1956 Broadcasts against the stack of matrices.
1957 hermitian : bool, optional
1958 If True, `a` is assumed to be Hermitian (symmetric if real-valued),
1959 enabling a more efficient method for finding singular values.
1960 Defaults to False.
1961
1962 .. versionadded:: 1.17.0
1963
1964 Returns
1965 -------
1966 B : (..., N, M) ndarray
1967 The pseudo-inverse of `a`. If `a` is a `matrix` instance, then so
1968 is `B`.
1969
1970 Raises
1971 ------
1972 LinAlgError
1973 If the SVD computation does not converge.
1974
1975 See Also
1976 --------
1977 scipy.linalg.pinv : Similar function in SciPy.
1978 scipy.linalg.pinvh : Compute the (Moore-Penrose) pseudo-inverse of a
1979 Hermitian matrix.
1980
1981 Notes
1982 -----
1983 The pseudo-inverse of a matrix A, denoted :math:`A^+`, is
1984 defined as: "the matrix that 'solves' [the least-squares problem]
1985 :math:`Ax = b`," i.e., if :math:`\\bar{x}` is said solution, then
1986 :math:`A^+` is that matrix such that :math:`\\bar{x} = A^+b`.
1987
1988 It can be shown that if :math:`Q_1 \\Sigma Q_2^T = A` is the singular
1989 value decomposition of A, then
1990 :math:`A^+ = Q_2 \\Sigma^+ Q_1^T`, where :math:`Q_{1,2}` are
1991 orthogonal matrices, :math:`\\Sigma` is a diagonal matrix consisting
1992 of A's so-called singular values, (followed, typically, by
1993 zeros), and then :math:`\\Sigma^+` is simply the diagonal matrix
1994 consisting of the reciprocals of A's singular values

Callers

nothing calls this directly

Calls 12

asarrayFunction · 0.90
amaxFunction · 0.90
multiplyFunction · 0.90
_makearrayFunction · 0.85
_is_empty_2dFunction · 0.85
wrapFunction · 0.85
divideFunction · 0.85
matmulFunction · 0.85
conjugateMethod · 0.80
svdFunction · 0.70
transposeFunction · 0.70
emptyFunction · 0.50

Tested by

no test coverage detected