Computes the Moore-Penrose generalized inverse of a matrix.
Usage
pinv(A, tol=.Machine$double.eps^(2/3))
Arguments
A
matrix
tol
tolerance used for assuming an eigenvalue is zero.
Value
The pseudoinverse of matrix A.
Details
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\$vX = V Dinv t(U)
Thus B is computed as s$v %*% diag(1/s$d) %*% t(s$u).
References
Ben-Israel, A., and Th. N. E. Greville (2003). Generalized Inverses -
Theory and Applications. Springer-Verlag, New York.