pseudoinverse: matrix pseudo inverse

Description Usage Arguments Examples

Description

computes a pseudo-inverse of a matrix (Moore-Penrose inverse)

Usage

1
  pseudoinverse(x, tol)

Arguments

x

a numeric matrix

tol

tolerance threshold for singular value positiveness

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
set.seed(3)

A = matrix(runif(9), 3, 3)

# pseudo inverse
B1 = pseudoinverse(A)

# A x B1
round(A %*% B1, 3)

# compare to 'ginv()'
library(MASS)
B2 = ginv(A)
B2
B1

gastonstat/matrixkit documentation built on May 16, 2019, 5:45 p.m.