Trait cont_arith_code::TruncatedDistribution

source ·
pub trait TruncatedDistribution: Debug {
    // Required methods
    fn quantile(&self, cp: f64) -> (Index, f64);
    fn truncate(&mut self, cp: f64, s: Index, s_rem: f64, bit: bool);
    fn lo(&self) -> Index;
    fn hi(&self) -> Index;

    // Provided method
    fn is_resolved(&self) -> bool { ... }
}
Expand description

A univariate distribution with a truncated probability mass between a lower- and upper-bound.

Required Methods§

source

fn quantile(&self, cp: f64) -> (Index, f64)

Quantile (inverse CDF) and decompose of the remaining probability mass. Given cp $\in$ [0-1), returns the symbol index (s: i64) in which it falls as well as the fraction (s_rem: f64 $\in$ [0-1)) achieved towards symbol s+1 in the cumulative probability assigned to s. Indexes must increase monotonically w.r.t. cp, and s_rem must increase linearly w.r.t. cp inside each s.

source

fn truncate(&mut self, cp: f64, s: Index, s_rem: f64, bit: bool)

Split the remaining probability mass with the given bit (false:0:left :: true:1:right) at the given cumulative probability, which we already know splits at index s with remainder s_rem.

source

fn lo(&self) -> Index

Return the index of the lower-bound of the interval of the truncation.

source

fn hi(&self) -> Index

Return the index of the upper-bound of the interval of the truncation.

Provided Methods§

source

fn is_resolved(&self) -> bool

True iff self.lo() == self.hi()

Implementors§