#' Checks if a positive definite matrix is an M-matrix
#'
#' Checks if all entries of K are smaller than a small positive number tol
#' @param K an inverse covariance matrix
#' @param tol numbers greater than tol are treated as positive
#' @keywords M-matrix
#' @export
#' @examples
#' print(TRUE)
#'
is.M <- function(K,tol=1e-10){
p <- nrow(K)
return(prod(1*(K<= 1e-10)+diag(p)))
}
is.IM <- function(S,tol=1e-10){
p <- nrow(S)
K <- solve(S)
return(prod(1*(K<= 1e-10)+diag(p)))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.