log_sum_exp {perms} | R Documentation |
Computes the log sum exp of a vector. Given input array = [x_1, ..., x_n], returns x_* + log(exp(x_1 - x_*) + ... + exp(x_n - x_*)), where x_* = max(x_1, ... x_n). Ignores entries with NA value.
log_sum_exp(x)
x |
Input vector. |
The log-sum-exp of the entries of the input vector.
library(perms)
x = c(1,2,3,-1,-1,1)
log_sum_exp(x)