#stable #logsumexp

logaddexp

stable implementations of logaddexp and logsumexp

4 releases

0.1.3 Feb 20, 2024
0.1.2 Mar 17, 2023
0.1.1 Oct 22, 2022
0.1.0 Oct 21, 2022

#647 in Machine learning

Download history 264/week @ 2025-09-18 322/week @ 2025-09-25 377/week @ 2025-10-02 426/week @ 2025-10-09 339/week @ 2025-10-16 439/week @ 2025-10-23 256/week @ 2025-10-30 447/week @ 2025-11-06 368/week @ 2025-11-13 443/week @ 2025-11-20 285/week @ 2025-11-27 414/week @ 2025-12-04 444/week @ 2025-12-11 132/week @ 2025-12-18 210/week @ 2026-01-01

923 downloads per month
Used in cfr

MIT license

9KB
129 lines

logaddexp-rs

crates.io docs license build

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.

Usage

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();

Dependencies

~140KB