pinv: Calculate the Moore-Penrose generalized inverse of a matrix

Description Usage Arguments Value References See Also Examples

View source: R/math_pinv.R

Description

Calculate the generalized inverse y of a matrix x, also known as Moore-Penrose inverse, using the singular value decomposition svd().

Usage

1
pinv(x, tol = .Machine$double.eps^(2/3))

Arguments

x

numeric matrix for which the Moore-Penrose inverse is required.

tol

value of tolerance used for assuming an eigenvalue is zero.

Value

y - matrix that is pseudoinverse of matrix x

References

Ben-Israel, A., and Th. N. E. Greville (2003). Generalized Inverses - Theory and Applications. Springer-Verlag, New York. ISBN 978-0-387-21634-8.

See Also

Other math: planck()

Examples

1
2
3
4
x <- matrix(c(7, 6, 4, 8, 10, 11, 12, 9, 3, 5, 1, 2), 3, 4)
b <- apply(x, 1, sum)  # 32 16 20 row sum
y <- pinv(x)
stopifnot(all.equal(drop(x %*% y %*% b), b))

omega1x/spectrotest documentation built on Oct. 1, 2020, 4 p.m.