Skip to main content

logsumexp

Function logsumexp 

Source
pub fn logsumexp(a: &[f64]) -> f64
Expand description

ln Σ exp(aᵢ) without overflow (SciPy’s logsumexp): with m = max aᵢ, the sum is m + ln Σ exp(aᵢ − m), whose terms are at most 1. Returns −∞ for an empty slice or when every term is −∞, and +∞ if any term is +∞.