pub struct LogProb(pub f64);Expand description
A probability stored as its natural logarithm: ln(p).
All values are ≤ 0 (since 0 < p ≤ 1), with 0.0 representing certainty (p = 1) and negative infinity representing impossibility (p = 0).
Tuple Fields§
§0: f64Implementations§
Source§impl LogProb
impl LogProb
Sourcepub fn ln_add(self, other: Self) -> Self
pub fn ln_add(self, other: Self) -> Self
Log-sum-exp: compute ln(exp(self) + exp(other)) without overflow.
This is the log-space equivalent of addition in probability space.
Sourcepub fn ln_mul(self, other: Self) -> Self
pub fn ln_mul(self, other: Self) -> Self
Multiply two probabilities in log-space (addition of log values).
Sourcepub const fn impossible() -> Self
pub const fn impossible() -> Self
Impossible event: ln(0) = -∞.
Trait Implementations§
Source§impl PartialOrd for LogProb
impl PartialOrd for LogProb
impl Copy for LogProb
impl StructuralPartialEq for LogProb
Auto Trait Implementations§
impl Freeze for LogProb
impl RefUnwindSafe for LogProb
impl Send for LogProb
impl Sync for LogProb
impl Unpin for LogProb
impl UnsafeUnpin for LogProb
impl UnwindSafe for LogProb
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more