addLogVector: Add a vector of log values.

Description Usage Arguments Details Value Author(s) See Also Examples

Description

When a summation must be taken on a vector of numbers that are on the log scale, transforming them back to the non-log scale and taking the sum is slow. This function takes the exp() of the values only when neccessary.

Usage

1

Arguments

x

Numeric vector containing values on a log scale to be summed on the untransformed scale.

Details

This function checks to see if the difference between the maximum values and the remaining values is less than the machine precision. If it is, then the exp() is taken for those values that differ by less than the machine precision, they are summed and returned to a log scale. If the maximum value is differs from the other values by greater than the machine precision, then return the maximum value.

Value

Numeric value containing the sum of the values on a log scale.

Author(s)

Daniel Gatti

See Also

addLog

Examples

1
  addLogVector(log(1:10))

DOQTL documentation built on May 6, 2019, 3:09 a.m.