log_sum_special: Computes log(sum(exp(x) * y)), or log(sum(exp(x))) if all(y...

View source: R/utils.R

log_sum_specialR Documentation

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

Description

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))).


edahelsinki/slise documentation built on Aug. 24, 2023, 11:03 p.m.