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

#325 in Programming languages

Download history 406/week @ 2024-06-10 427/week @ 2024-06-17 271/week @ 2024-06-24 331/week @ 2024-07-01 368/week @ 2024-07-08 423/week @ 2024-07-15 454/week @ 2024-07-22 806/week @ 2024-07-29 457/week @ 2024-08-05 132/week @ 2024-08-12 65/week @ 2024-08-19 165/week @ 2024-08-26 113/week @ 2024-09-02 132/week @ 2024-09-09 118/week @ 2024-09-16 359/week @ 2024-09-23

729 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

~155KB