\name{is.pdm} \alias{is.pdm} \title{Checks if a matrix is positive definite.} \description{ This checks if a matrix is positive definite and hence a valid covariance or precision matrix. Note that if the argument is not a square matrix, it returns \code{FALSE}, and it should not signal an error. } \usage{ is.pdm(m, tol = sqrt(.Machine$double.eps)) } \arguments{ \item{m}{Matrix to be tested.} \item{tol}{Tolerance check for symmetry and zero eignevalues.} } \details{ A matrix \code{m} is considered positive definite if it has the following properites. \enumerate{ \item{It is a matrix.} \item{It is numeric (complex matrixes are not considered).} \item{No entries are \code{NA}.} \item{It is square.} \item{It is symmetric (\code{m} is equal to \code{t(m)} within the specified tolerance).} \item{All of the eigenvalues are at least as big as \code{tol}.} } Note that this function is designed to return \code{FALSE} if any of the values are true, including non-matrix arguments. } \value{ A logical scalar indicating whether or not the argument is positive definite. } \author{Russell Almond} \seealso{ The \code{\link{is.pd}()} method of \code{\link{TimelessNormalParam}} uses this method by default to determine if the scale matrix is positive definite. } \examples{ stopifnot( is.pdm(diag(1:3)), is.pdm(matrix(c(.7,.3,.3,.7),2,2)), !is.pdm(matrix(1,2,2)), !is.pdm(matrix(NA,2,2)), !is.pdm(matrix(c(1,0,0,.3,1,.4),3,2)), !is.pdm(1:10) ) } \keyword{ algebra }