R/symSqrt.R

Defines functions `symSqrt`

`symSqrt` <-
function(cc,inv=FALSE)
{
  e<-eigen(cc)
  ev<-e$values
  ind<-which(ev>0)
  lbd<-rep(0,length(ev))
  if (inv) lbd[ind]<-1/sqrt(ev[ind]) else lbd[ind]<-sqrt(ev[ind])
  kk<-e$vectors
  return(kk%*%(lbd*t(kk)))
}

Try the anacor package in your browser

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

anacor documentation built on June 10, 2022, 5:09 p.m.