Learn R Programming

TRSbook (version 1.0.2)

mpinv: Moore Penrose inverse

Description

Computes the Moore Penrose inverse of a matrix

Usage

mpinv(M,eps=1e-13)

Arguments

M

a matrix

eps

real precision

Value

The Moore-Penrose inverse of M

References

Chapter 10 (Basic Mathematics: Matrix Operations, Integration, and Optimization) from the book: The R Software, Fundamentals of Programming and Statistical Analysis

Examples

Run this code
# NOT RUN {
A <- matrix(c(2,3,5,4),nrow=2,ncol=2)
solve(A)
mpinv(A)
B <- matrix(c(4,2,8,4),nrow=2,ncol=2)
# solve(B) # gives an error.
mpinv(B)
# }

Run the code above in your browser using DataLab