log_sum_of_logs: Computes the log of a sum of numbers all given in log-space.

Description Usage Arguments Value

Description

Given a sequence of numbers [\log(x_1), \log(x_2), ..., \log(x_n)], computes \log(∑_{i = 1}^n x_i). For adding two numbers that are given in log space we use the expression max(x, y) + log1p(exp(-abs(x - y))) which is a good approximation if x and y are of the same order of magnitude, but if they are of very different sizes just returns the maximum of the two. To prevent adding numbers of very different magnitude we iteratively add the numbers pairwise. Because of numerical issues with doing this, the order of the input values can affect the result.

Usage

1
log_sum_of_logs(log_values)

Arguments

log_values

Sequence of numbers in log space [\log(x_1), \log(x_2), ..., \log(x_n)].

Value

\log(∑_{i = 1}^n x_i).


admixturegraph documentation built on May 2, 2019, 6:02 a.m.