Trait constriction::stream::model::SymbolTable
source · 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§
fn left_cumulative(&self, index: usize) -> Option<Probability>
fn support_size(&self) -> usize
sourceunsafe fn left_cumulative_unchecked(&self, index: usize) -> Probability
unsafe fn left_cumulative_unchecked(&self, index: usize) -> Probability
Safety
Argument index
must be strictly smaller than 1 << PRECISION
(for PRECISION != Probability::BITS
).
sourceunsafe fn symbol_unchecked(&self, index: usize) -> Symbol
unsafe fn symbol_unchecked(&self, index: usize) -> Symbol
Safety
Argument symbol
must be in the support of the model.
Provided Methods§
sourcefn quantile_function<const PRECISION: usize>(
&self,
quantile: Probability
) -> (Symbol, Probability, Probability::NonZero)
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.