pub trait SymbolTable<Symbol, Probability: BitArray> {
    // Required methods
    fn left_cumulative(&self, index: usize) -> Option<Probability>;
    fn support_size(&self) -> usize;
    unsafe fn left_cumulative_unchecked(&self, index: usize) -> Probability;
    unsafe fn symbol_unchecked(&self, index: usize) -> Symbol;

    // Provided method
    fn quantile_function<const PRECISION: usize>(
        &self,
        quantile: Probability
    ) -> (Symbol, Probability, Probability::NonZero) { ... }
}
Expand description

A trait for internal representations of various forms of categorical entropy models.

This trait will become private once anonymous return types are allowed in trait methods. Do not use it outside of the constriction library.

Required Methods§

source

fn left_cumulative(&self, index: usize) -> Option<Probability>

source

fn support_size(&self) -> usize

source

unsafe fn left_cumulative_unchecked(&self, index: usize) -> Probability

Safety

Argument index must be strictly smaller than 1 << PRECISION (for PRECISION != Probability::BITS).

source

unsafe fn symbol_unchecked(&self, index: usize) -> Symbol

Safety

Argument symbol must be in the support of the model.

Provided Methods§

source

fn quantile_function<const PRECISION: usize>( &self, quantile: Probability ) -> (Symbol, Probability, Probability::NonZero)

Bisects the symbol table to find the bin that contains quantile.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<Symbol, Probability, Table> SymbolTable<Symbol, Probability> for ContiguousSymbolTable<Table>
where Probability: BitArray, Table: AsRef<[Probability]>, Symbol: BitArray + Into<usize>, usize: AsPrimitive<Symbol>,

source§

impl<Symbol, Probability, Table> SymbolTable<Symbol, Probability> for NonContiguousSymbolTable<Table>
where Probability: BitArray, Symbol: Clone, Table: AsRef<[(Probability, Symbol)]>,