Expand description
Crate for computing ln_add_exp and
ln_sum_exp
These functions allow more numerically stable implementations for this order of operations than doing them naively. They come in handy when doing computation in log-space.
§Examples
If you have a large number in log space, you can add one to it by doing
use logaddexp::LogAddExp;
let ln_large_number: f64 = // ...
let ln_large_number_1p = ln_large_number.ln_add_exp(0.0);You can use LogSumExp to handle an Iterator of floats.
use logaddexp::LogSumExp;
(1..100).into_iter().map(|v| v as f64).ln_sum_exp();