Skip to contents

Computes log(sum(exp(x) * y)), or log(sum(exp(x))) if all(y == 0), in a numerically robust way.

Usage

log_sum_special(x, y)

Arguments

x

vector of length n

y

multiplier

Value

log(sum(exp(x))).