Trait cont_arith_code::Model

source ·
pub trait Model<T> {
    // Required methods
    fn push(&mut self, s: Index) -> Option<T>;
    fn next_distr(&mut self) -> Box<dyn UnivariateDistribution>;
}
Expand description

Models produce distributions and consume their resolutions (as i64s) until a value T pops out. Used by both Encoder and Decoder symmetrically.

Required Methods§

source

fn push(&mut self, s: Index) -> Option<T>

Push a value into the model and updates its state. Returns a values once it’s been fully described by a series of indexes.

source

fn next_distr(&mut self) -> Box<dyn UnivariateDistribution>

Get the distribution for the next symbol from the model.

Implementations on Foreign Types§

source§

impl<A: Model<T>, T, B: Model<U>, U> Model<(T, U)> for (Option<T>, (A, B))

A pair of models can model a pair of values.

source§

fn push(&mut self, s: Index) -> Option<(T, U)>

source§

fn next_distr(&mut self) -> Box<dyn UnivariateDistribution>

Implementors§

source§

impl Model<i64> for Gaussian

source§

impl Model<Vec<i64>> for WithReplacement

source§

impl Model<Vec<i64>> for WithoutReplacement

source§

impl<D: UnivariateDistribution + Clone + 'static, T> Model<Vec<T>> for Samples<D, T>

source§

impl<D: UnivariateDistribution + Clone + 'static, T> Model<T> for Sample<D, T>

source§

impl<T: Clone + Ord + Debug + 'static> Model<T> for Categorical<T>