Struct constriction::stream::model::UniformModel

source ·
pub struct UniformModel<Probability: BitArray, const PRECISION: usize> { /* private fields */ }

Implementations§

source§

impl<Probability: BitArray, const PRECISION: usize> UniformModel<Probability, PRECISION>

source

pub fn new(range: usize) -> Self
where usize: AsPrimitive<Probability>, Probability: AsPrimitive<usize>,

Trait Implementations§

source§

impl<Probability: Clone + BitArray, const PRECISION: usize> Clone for UniformModel<Probability, PRECISION>
where Probability::NonZero: Clone,

source§

fn clone(&self) -> UniformModel<Probability, PRECISION>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<Probability: Debug + BitArray, const PRECISION: usize> Debug for UniformModel<Probability, PRECISION>
where Probability::NonZero: Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<Probability, const PRECISION: usize> DecoderModel<PRECISION> for UniformModel<Probability, PRECISION>
where Probability: AsPrimitive<usize> + BitArray,

source§

fn quantile_function( &self, quantile: Self::Probability, ) -> (Self::Symbol, Self::Probability, <Self::Probability as BitArray>::NonZero)

Looks up the symbol for a given quantile. Read more
source§

impl<Probability: BitArray, const PRECISION: usize> EncoderModel<PRECISION> for UniformModel<Probability, PRECISION>
where usize: AsPrimitive<Probability>,

source§

fn left_cumulative_and_probability( &self, symbol: impl Borrow<Self::Symbol>, ) -> Option<(Self::Probability, <Self::Probability as BitArray>::NonZero)>

Looks up a symbol in the entropy model. Read more
source§

fn floating_point_probability<F>(&self, symbol: Self::Symbol) -> F
where F: FloatCore, Self::Probability: Into<F>,

Returns the probability of the given symbol in floating point representation. Read more
source§

impl<Probability: BitArray, const PRECISION: usize> EntropyModel<PRECISION> for UniformModel<Probability, PRECISION>

source§

type Symbol = usize

The type of data over which the entropy model is defined. Read more
source§

type Probability = Probability

The type used to represent probabilities, cumulatives, and quantiles. Read more
source§

impl<'m, Probability, const PRECISION: usize> IterableEntropyModel<'m, PRECISION> for UniformModel<Probability, PRECISION>
where Probability: AsPrimitive<usize> + BitArray, usize: AsPrimitive<Probability>,

source§

fn symbol_table( &'m self, ) -> impl Iterator<Item = (Self::Symbol, Self::Probability, <Self::Probability as BitArray>::NonZero)>

Iterates over all symbols in the unique order that is consistent with the cumulative distribution. Read more
source§

fn floating_point_symbol_table<F>( &'m self, ) -> impl Iterator<Item = (Self::Symbol, F, F)>
where F: FloatCore + From<Self::Probability> + 'm, Self::Probability: Into<F>,

Similar to symbol_table, but yields both cumulatives and probabilities in floating point representation. Read more
source§

fn entropy_base2<F>(&'m self) -> F
where F: Float + Sum, Self::Probability: Into<F>,

Returns the entropy in units of bits (i.e., base 2). Read more
source§

fn cross_entropy_base2<F>(&'m self, p: impl IntoIterator<Item = F>) -> F
where F: Float + Sum, Self::Probability: Into<F>,

Returns the cross entropy between argument p and this model in units of bits (i.e., base 2). Read more
source§

fn reverse_cross_entropy_base2<F>(&'m self, p: impl IntoIterator<Item = F>) -> F
where F: Float + Sum, Self::Probability: Into<F>,

Returns the cross entropy between this model and argument p in units of bits (i.e., base 2). Read more
source§

fn kl_divergence_base2<F>(&'m self, p: impl IntoIterator<Item = F>) -> F
where F: Float + Sum, Self::Probability: Into<F>,

Returns Kullback-Leibler divergence D_KL(p || self) Read more
source§

fn reverse_kl_divergence_base2<F>(&'m self, p: impl IntoIterator<Item = F>) -> F
where F: Float + Sum, Self::Probability: Into<F>,

Returns reverse Kullback-Leibler divergence, i.e., D_KL(self || p) Read more
source§

impl<Probability: Copy + BitArray, const PRECISION: usize> Copy for UniformModel<Probability, PRECISION>
where Probability::NonZero: Copy,

Auto Trait Implementations§

§

impl<Probability, const PRECISION: usize> Freeze for UniformModel<Probability, PRECISION>
where <Probability as BitArray>::NonZero: Freeze, Probability: Freeze,

§

impl<Probability, const PRECISION: usize> RefUnwindSafe for UniformModel<Probability, PRECISION>
where <Probability as BitArray>::NonZero: RefUnwindSafe, Probability: RefUnwindSafe,

§

impl<Probability, const PRECISION: usize> Send for UniformModel<Probability, PRECISION>
where <Probability as BitArray>::NonZero: Send, Probability: Send,

§

impl<Probability, const PRECISION: usize> Sync for UniformModel<Probability, PRECISION>
where <Probability as BitArray>::NonZero: Sync, Probability: Sync,

§

impl<Probability, const PRECISION: usize> Unpin for UniformModel<Probability, PRECISION>
where <Probability as BitArray>::NonZero: Unpin, Probability: Unpin,

§

impl<Probability, const PRECISION: usize> UnwindSafe for UniformModel<Probability, PRECISION>
where <Probability as BitArray>::NonZero: UnwindSafe, Probability: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.