R/logsumexp.R

Defines functions logsumexp

Documented in logsumexp

# vim: set noexpandtab tabstop=2:
#' Sum of Numbers in Log-Scale
#'
#' Sum of Numbers in Log-Scale
#'
#' @param x a numeric vector
#' @keywords math
logsumexp=function(x) {
	mx=max(x)
	log(sum(exp(x-mx)))+mx
}

Try the brt package in your browser

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

brt documentation built on May 2, 2019, 10:22 a.m.