R/logsumexp.R

Defines functions logsumexp

Documented in logsumexp

#' log summation of exponential function
#'
#' log summation of exponential variable vector.
#' @param x A variable vector.
#' @return
#' \item{val}{log summation of exponential variable vector.}
#' @export
#'
logsumexp <- function(x){
  log(sum(exp(x - max(x)))) + max(x)
}

Try the gmmsslm package in your browser

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

gmmsslm documentation built on June 8, 2025, 2 p.m.