Enum rv::data::DataOrSuffStat [−][src]
pub enum DataOrSuffStat<'a, X, Fx> where
X: 'a,
Fx: 'a + HasSuffStat<X>, { Data(&'a [X]), SuffStat(&'a Fx::Stat), None, }
Expand description
Holds either a sufficient statistic of a vector of data.
Variants
Data(&'a [X])
A Vec
of raw data
SuffStat(&'a Fx::Stat)
A sufficient statistic
No data
Implementations
Determine whether the object contains data
Example
use rv::dist::Gaussian; use rv::data::GaussianSuffStat; let xs = vec![1.0_f64]; let data: DataOrSuffStat<f64, Gaussian> = DataOrSuffStat::Data(&xs); assert!(data.is_data()); let gauss_stats = GaussianSuffStat::new(); let suffstat: DataOrSuffStat<f64, Gaussian> = DataOrSuffStat::SuffStat(&gauss_stats); assert!(!suffstat.is_data());
Determine whether the object contains sufficient statistics
Example
use rv::dist::Gaussian; use rv::data::GaussianSuffStat; let xs = vec![1.0_f64]; let data: DataOrSuffStat<f64, Gaussian> = DataOrSuffStat::Data(&xs); assert!(!data.is_suffstat()); let gauss_stats = GaussianSuffStat::new(); let suffstat: DataOrSuffStat<f64, Gaussian> = DataOrSuffStat::SuffStat(&gauss_stats); assert!(suffstat.is_suffstat());
Determine whether the object is empty
Example
use rv::dist::Gaussian; use rv::data::GaussianSuffStat; let xs = vec![1.0_f64]; let data: DataOrSuffStat<f64, Gaussian> = DataOrSuffStat::Data(&xs); assert!(!data.is_none()); let gauss_stats = GaussianSuffStat::new(); let suffstat: DataOrSuffStat<f64, Gaussian> = DataOrSuffStat::SuffStat(&gauss_stats); assert!(!suffstat.is_none()); let none: DataOrSuffStat<f64, Gaussian> = DataOrSuffStat::None; assert!(none.is_none());
Trait Implementations
impl<'a, X: Clone, Fx: Clone> Clone for DataOrSuffStat<'a, X, Fx> where
X: 'a,
Fx: 'a + HasSuffStat<X>,
Fx::Stat: Clone,
[src]
impl<'a, X: Clone, Fx: Clone> Clone for DataOrSuffStat<'a, X, Fx> where
X: 'a,
Fx: 'a + HasSuffStat<X>,
Fx::Stat: Clone,
[src]impl<'a, X: Debug, Fx: Debug> Debug for DataOrSuffStat<'a, X, Fx> where
X: 'a,
Fx: 'a + HasSuffStat<X>,
Fx::Stat: Debug,
[src]
impl<'a, X: Debug, Fx: Debug> Debug for DataOrSuffStat<'a, X, Fx> where
X: 'a,
Fx: 'a + HasSuffStat<X>,
Fx::Stat: Debug,
[src]impl<'a, X> From<&'a BernoulliSuffStat> for DataOrSuffStat<'a, X, Bernoulli> where
X: Booleable,
[src]
impl<'a, X> From<&'a BernoulliSuffStat> for DataOrSuffStat<'a, X, Bernoulli> where
X: Booleable,
[src]Performs the conversion.
impl<'a, X> From<&'a CategoricalSuffStat> for DataOrSuffStat<'a, X, Categorical> where
X: CategoricalDatum,
[src]
impl<'a, X> From<&'a CategoricalSuffStat> for DataOrSuffStat<'a, X, Categorical> where
X: CategoricalDatum,
[src]Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
impl<'a, X> From<&'a Vec<X, Global>> for DataOrSuffStat<'a, X, Categorical> where
X: CategoricalDatum,
[src]
impl<'a, X> From<&'a Vec<X, Global>> for DataOrSuffStat<'a, X, Categorical> where
X: CategoricalDatum,
[src]impl<'a, X: PartialEq, Fx: PartialEq> PartialEq<DataOrSuffStat<'a, X, Fx>> for DataOrSuffStat<'a, X, Fx> where
X: 'a,
Fx: 'a + HasSuffStat<X>,
Fx::Stat: PartialEq,
[src]
impl<'a, X: PartialEq, Fx: PartialEq> PartialEq<DataOrSuffStat<'a, X, Fx>> for DataOrSuffStat<'a, X, Fx> where
X: 'a,
Fx: 'a + HasSuffStat<X>,
Fx::Stat: PartialEq,
[src]This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
impl<'a, X, Fx> StructuralPartialEq for DataOrSuffStat<'a, X, Fx> where
X: 'a,
Fx: 'a + HasSuffStat<X>,
[src]Auto Trait Implementations
impl<'a, X, Fx> RefUnwindSafe for DataOrSuffStat<'a, X, Fx> where
X: RefUnwindSafe,
<Fx as HasSuffStat<X>>::Stat: RefUnwindSafe,
impl<'a, X, Fx> Send for DataOrSuffStat<'a, X, Fx> where
X: Sync,
<Fx as HasSuffStat<X>>::Stat: Sync,
impl<'a, X, Fx> Sync for DataOrSuffStat<'a, X, Fx> where
X: Sync,
<Fx as HasSuffStat<X>>::Stat: Sync,
impl<'a, X, Fx> Unpin for DataOrSuffStat<'a, X, Fx>
impl<'a, X, Fx> UnwindSafe for DataOrSuffStat<'a, X, Fx> where
X: RefUnwindSafe,
<Fx as HasSuffStat<X>>::Stat: RefUnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
type Output = T
type Output = T
Should always be Self
The inverse inclusion map: attempts to construct self
from the equivalent element of its
superset. Read more
pub fn is_in_subset(&self) -> bool
pub fn is_in_subset(&self) -> bool
Checks if self
is actually part of its subset T
(and can be converted to it).
pub fn to_subset_unchecked(&self) -> SS
pub fn to_subset_unchecked(&self) -> SS
Use with care! Same as self.to_subset
but without any property checks. Always succeeds.
pub fn from_subset(element: &SS) -> SP
pub fn from_subset(element: &SS) -> SP
The inclusion map: converts self
to the equivalent element of its superset.
pub fn vzip(self) -> V