Computes the Moore-Penrose generalized inverse of a matrix.
real or complex matrix
tolerance used for assuming an eigenvalue is zero.
Compute the generalized inverse
B of a matrix
A using the
singular value decomposition
svd(). This generalized invers is
characterized by this equation:
A %*% B %*% A == A
The pseudoinverse B solves the problem to minimize |A x - b| by setting x = B b
s <- svd(A)
D <- diag(s\$d)
Dinv <- diag(1/s\$d)
U <- s\$u; V <- s\$v
X = V Dinv t(U)
B is computed as
s$v %*% diag(1/s$d) %*% t(s$u).
The pseudoinverse of matrix
The pseudoinverse or ‘generalized inverse’ is also provided by the function
ginv() in package ‘MASS’. It is included in a somewhat simplified
way to be independent of that package.
Ben-Israel, A., and Th. N. E. Greville (2003). Generalized Inverses - Theory and Applications. Springer-Verlag, New York.
1 2 3 4
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.