R/matsqsym.R

Defines functions matsqsym

# This function assumes that mat, if a matrix, is symmetric.
matsqsym <-
function(mat){
  stopifnot(is.numeric(mat))
  if(is.matrix(mat)){
    stopifnot(identical(diff(dim(mat)), 0L))
    output <- crossprod(mat)
  } else {
    # This allows covariance specification in the form of a numeric vector.
    output <- mat * mat
  }
  return(output)
}

Try the distfreereg package in your browser

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

distfreereg documentation built on April 4, 2025, 12:30 a.m.