R/checkPD.R

Defines functions checkPD

###
### R routines for the R package mvmeta (c)
#
checkPD <- 
function(mat, k, label="matrix") {
#
################################################################################
# 
  if(any(dim(mat)!=k)) stop(paste("wrong dimensions for '",label,"'",sep=""))
  eig <- eigen(mat)
  if(any(eig$values<0)) 
    stop(paste("values for '",label,
      "' do not produce a positive-definite matrix",sep=""))
#
  mat
}

Try the mvmeta package in your browser

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

mvmeta documentation built on Dec. 10, 2019, 5:07 p.m.