Struct cont_arith_code::distribution::gaussian::TruncatedGaussian
source · pub struct TruncatedGaussian {
pub gaussian: Gaussian,
pub lo: i64,
pub bins: TruncatedCategorical,
pub hi: i64,
pub ln_prob: f64,
}
Fields§
§gaussian: Gaussian
§lo: i64
§bins: TruncatedCategorical
§hi: i64
§ln_prob: f64
Implementations§
Trait Implementations§
source§impl Clone for TruncatedGaussian
impl Clone for TruncatedGaussian
source§fn clone(&self) -> TruncatedGaussian
fn clone(&self) -> TruncatedGaussian
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for TruncatedGaussian
impl Debug for TruncatedGaussian
source§impl PartialEq for TruncatedGaussian
impl PartialEq for TruncatedGaussian
source§fn eq(&self, other: &TruncatedGaussian) -> bool
fn eq(&self, other: &TruncatedGaussian) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for TruncatedGaussian
impl PartialOrd for TruncatedGaussian
source§fn partial_cmp(&self, other: &TruncatedGaussian) -> Option<Ordering>
fn partial_cmp(&self, other: &TruncatedGaussian) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl TruncatedDistribution for TruncatedGaussian
impl TruncatedDistribution for TruncatedGaussian
source§fn quantile(&self, cp: f64) -> (i64, f64)
fn quantile(&self, cp: f64) -> (i64, 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
.source§fn truncate(&mut self, cp: f64, s: i64, s_rem: f64, bit: bool)
fn truncate(&mut self, cp: f64, s: i64, s_rem: f64, bit: bool)
Split the remaining probability mass with the given bit
(false:0:left :: true:1:right) at the given cumulative
probability, which we already know splits at index
s
with
remainder s_rem
.source§fn is_resolved(&self) -> bool
fn is_resolved(&self) -> bool
True iff
self.lo() == self.hi()
impl StructuralPartialEq for TruncatedGaussian
Auto Trait Implementations§
impl Freeze for TruncatedGaussian
impl RefUnwindSafe for TruncatedGaussian
impl Send for TruncatedGaussian
impl Sync for TruncatedGaussian
impl Unpin for TruncatedGaussian
impl UnwindSafe for TruncatedGaussian
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.