R/mat.sqrt.R

"mat.sqrt" <- function(x) {
   e <- eigen(x)
   sqrt.ev <- sqrt(e$values)   #need to put in a check here for postive semi definite
   inv.evec <- solve(e$vectors)
   result <- e$vectors %*% diag(sqrt.ev) %*% inv.evec
   result}

   

Try the psych package in your browser

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

psych documentation built on Sept. 26, 2023, 1:06 a.m.