Movatterモバイル変換


[0]ホーム

URL:


SciPy

numpy.linalg.pinv

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

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

Calculate the generalized inverse of a matrix using itssingular-value decomposition (SVD) and including alllarge singular values.

Parameters:

a : (M, N) array_like

Matrix to be pseudo-inverted.

rcond : float

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

Returns:

B : (N, M) ndarray

The pseudo-inverse ofa. Ifa is amatrix instance, then soisB.

Raises:

LinAlgError

If the SVD computation does not converge.

Notes

The pseudo-inverse of a matrix A, denotedA^+, isdefined as: “the matrix that ‘solves’ [the least-squares problem]Ax = b,” i.e., if\bar{x} is said solution, thenA^+ is that matrix such that\bar{x} = A^+b.

It can be shown that ifQ_1 \Sigma Q_2^T = A is the singularvalue decomposition of A, thenA^+ = Q_2 \Sigma^+ Q_1^T, whereQ_{1,2} areorthogonal matrices,\Sigma is a diagonal matrix consistingof A’s so-called singular values, (followed, typically, byzeros), and then\Sigma^+ is simply the diagonal matrixconsisting of the reciprocals of A’s singular values(again, followed by zeros).[R47]

References

[R47](1,2) G. Strang,Linear Algebra and Its Applications, 2nd Ed., Orlando,FL, Academic Press, Inc., 1980, pp. 139-142.

Examples

The following example checks thata*a+*a==a anda+*a*a+==a+:

>>>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

  • © Copyright 2008-2009, The Scipy community.
  • Last updated on Jun 10, 2017.
  • Created usingSphinx 1.5.3.

[8]ページ先頭

©2009-2025 Movatter.jp