R/sigmaMatrix-sigmacap-check-dot.R

Defines functions .check_sigmacap

#' Sanity Check for the Covariance Matrix
#'
#' @author Ivan Jacob Agaloos Pesigan
#'
#' @param x Covariance matrix.
#' @param return_k Logical.
#'   Return the dimension of the covariance matrix.
#' @family Covariance Functions
#' @keywords sigmaMatrix covariance check
#' @noRd
.check_sigmacap <- function(x,
                            return_k = FALSE) {
  stopifnot(
    is.matrix(x),
    x == t(x)
  )
  stopifnot(
    all(
      diag(x) > 0
    )
  )
  if (return_k) {
    return(dim(x)[1])
  }
}
jeksterslab/sigmaMatrix documentation built on Dec. 20, 2021, 10:12 p.m.