addLogVector | R Documentation |
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.
addLogVector(x)
x |
Numeric vector containing values on a log scale to be summed on the untransformed scale. |
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.
Numeric value containing the sum of the values on a log scale.
Daniel Gatti
addLog
addLogVector(log(1:10))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.