R/MPinverse.R

Defines functions MPinverse

Documented in MPinverse

MPinverse <-
function(Matrix)
{
EPS <- 100*(.Machine$double.eps)
U <- eigen(Matrix)$vectors
D <- eigen(Matrix)$values
Dmatrix <- diag(length(D))
Dmatrix[which(Dmatrix>0)] <- 1/D
Dmatrix[which(abs(Dmatrix)>(1/EPS))] <- 0
A <- U%*%Dmatrix%*%t(U)
return(A)
}

Try the ES package in your browser

Any scripts or data that you put into this service are public.

ES documentation built on May 2, 2019, 8:29 a.m.