log_sum_exp {perms} | R Documentation |
log_sum_exp
Description
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.
Usage
log_sum_exp(x)
Arguments
x |
Input vector. |
Value
The log-sum-exp of the entries of the input vector.
Examples
library(perms)
x = c(1,2,3,-1,-1,1)
log_sum_exp(x)
[Package perms version 1.13 Index]