Crates.io | logaddexp |
lib.rs | logaddexp |
version | 0.1.3 |
source | src |
created_at | 2022-10-21 23:47:50.686071 |
updated_at | 2024-02-20 13:59:07.564831 |
description | stable implementations of logaddexp and logsumexp |
homepage | |
repository | https://github.com/erikbrinkman/logaddexp-rs |
max_upload_size | |
id | 693995 |
size | 9,705 |
Stable implementations of logaddexp and logsumexp in rust. Computing
log(sum_i(exp(v_i)))
for more than one value can esily result in overflow.
This crate provies implementations for two (ln_add_exp) and many (ln_sum_exp)
that are more stable (less prone to overfloe) than doing that computation
naively.
Run
$ cargo add logadexp
Then import the trait you want to use and call the function on the appropriate types
use logaddexp::LogAddExp;
f64::ln_add_exp(..., ...);
use logaddexp::LogSumExp;
[...].into_iter().ln_sum_exp();