logsumexp: Calculate the logarithm of the sum of the exponentials of the...

View source: R/RcppExports.R

logsumexpR Documentation

Calculate the logarithm of the sum of the exponentials of the arguments

Description

Calculation of the log of the sum of exponential of x, but avoids computational underflow / overflow

Usage

logsumexp(x)

Arguments

x

vector

Value

the logarithm of the sum of the exponentials of elements of x i.e. returns log(sum(exp(x)))

Examples

x <- c(1000.01, 1000.02)
y1 <- log(sum(exp(x)))
print(y1)
y2 <- logsumexp(x)
print(y2) 

rchan26/hierarchicalFusion documentation built on Sept. 11, 2022, 10:30 p.m.