R/matsqrt.R

Defines functions matsqrt

Documented in matsqrt

matsqrt <- function(x) {
xe <- eigen(x)
xe.v <- xe$values
if(all(xe.v >= 0)) {
xe.v1 <- diag(sqrt(xe.v))
}
xvalue <- cbind(xe$vectors)
xvalue.1 <- solve(xvalue)
out <- xvalue %*% xe.v1 %*% xvalue.1
out
}

Try the mixtools package in your browser

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

mixtools documentation built on Dec. 5, 2022, 5:23 p.m.