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§
sourcefn quantile(&self, cp: f64) -> (Index, f64)
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
.
Provided Methods§
sourcefn is_resolved(&self) -> bool
fn is_resolved(&self) -> bool
True iff self.lo() == self.hi()