Enum rv::data::DataOrSuffStat [−][src]
Holds either a sufficient statistic of a vector of data.
Variants
Data(&'a Vec<X>)
A Vec
of raw data
SuffStat(&'a Fx::Stat)
A sufficient statistic
No data
Implementations
impl<'a, X, Fx> DataOrSuffStat<'a, X, Fx> where
X: 'a,
Fx: 'a + HasSuffStat<X>,
[src]
X: 'a,
Fx: 'a + HasSuffStat<X>,
pub fn n(&self) -> usize
[src]
Get the number of observations
pub fn is_data(&self) -> bool
[src]
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());
pub fn is_suffstat(&self) -> bool
[src]
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());
pub fn is_none(&self) -> bool
[src]
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]
X: 'a,
Fx: 'a + HasSuffStat<X>,
Fx::Stat: Clone,
fn clone(&self) -> DataOrSuffStat<'a, X, Fx>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<'a, X: Debug, Fx: Debug> Debug for DataOrSuffStat<'a, X, Fx> where
X: 'a,
Fx: 'a + HasSuffStat<X>,
Fx::Stat: Debug,
[src]
X: 'a,
Fx: 'a + HasSuffStat<X>,
Fx::Stat: Debug,
impl<'a, X> From<&'a BernoulliSuffStat> for DataOrSuffStat<'a, X, Bernoulli> where
X: Booleable,
[src]
X: Booleable,
fn from(stat: &'a BernoulliSuffStat) -> Self
[src]
impl<'a, X> From<&'a CategoricalSuffStat> for DataOrSuffStat<'a, X, Categorical> where
X: CategoricalDatum,
[src]
X: CategoricalDatum,
fn from(stat: &'a CategoricalSuffStat) -> Self
[src]
impl<'a> From<&'a GaussianSuffStat> for DataOrSuffStat<'a, f32, Gaussian>
[src]
fn from(stat: &'a GaussianSuffStat) -> Self
[src]
impl<'a> From<&'a GaussianSuffStat> for DataOrSuffStat<'a, f64, Gaussian>
[src]
fn from(stat: &'a GaussianSuffStat) -> Self
[src]
impl<'a> From<&'a PoissonSuffStat> for DataOrSuffStat<'a, u8, Poisson>
[src]
fn from(stat: &'a PoissonSuffStat) -> Self
[src]
impl<'a> From<&'a PoissonSuffStat> for DataOrSuffStat<'a, u16, Poisson>
[src]
fn from(stat: &'a PoissonSuffStat) -> Self
[src]
impl<'a> From<&'a PoissonSuffStat> for DataOrSuffStat<'a, u32, Poisson>
[src]
fn from(stat: &'a PoissonSuffStat) -> Self
[src]
impl<'a, X> From<&'a Vec<X, Global>> for DataOrSuffStat<'a, X, Bernoulli> where
X: Booleable,
[src]
X: Booleable,
impl<'a, X> From<&'a Vec<X, Global>> for DataOrSuffStat<'a, X, Categorical> where
X: CategoricalDatum,
[src]
X: CategoricalDatum,
impl<'a> From<&'a Vec<f32, Global>> for DataOrSuffStat<'a, f32, Gaussian>
[src]
impl<'a> From<&'a Vec<f64, Global>> for DataOrSuffStat<'a, f64, Gaussian>
[src]
impl<'a> From<&'a Vec<u16, Global>> for DataOrSuffStat<'a, u16, Poisson>
[src]
impl<'a> From<&'a Vec<u32, Global>> for DataOrSuffStat<'a, u32, Poisson>
[src]
impl<'a> From<&'a Vec<u8, Global>> for DataOrSuffStat<'a, u8, Poisson>
[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]
X: 'a,
Fx: 'a + HasSuffStat<X>,
Fx::Stat: PartialEq,
fn eq(&self, other: &DataOrSuffStat<'a, X, Fx>) -> bool
[src]
fn ne(&self, other: &DataOrSuffStat<'a, X, Fx>) -> bool
[src]
impl<'a, X, Fx> StructuralPartialEq for DataOrSuffStat<'a, X, Fx> where
X: 'a,
Fx: 'a + HasSuffStat<X>,
[src]
X: 'a,
Fx: 'a + HasSuffStat<X>,
Auto Trait Implementations
impl<'a, X, Fx> RefUnwindSafe for DataOrSuffStat<'a, X, Fx> where
X: RefUnwindSafe,
<Fx as HasSuffStat<X>>::Stat: RefUnwindSafe,
[src]
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,
[src]
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,
[src]
X: Sync,
<Fx as HasSuffStat<X>>::Stat: Sync,
impl<'a, X, Fx> Unpin for DataOrSuffStat<'a, X, Fx>
[src]
impl<'a, X, Fx> UnwindSafe for DataOrSuffStat<'a, X, Fx> where
X: RefUnwindSafe,
<Fx as HasSuffStat<X>>::Stat: RefUnwindSafe,
[src]
X: RefUnwindSafe,
<Fx as HasSuffStat<X>>::Stat: RefUnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
SS: SubsetOf<SP>,
pub fn to_subset(&self) -> Option<SS>
pub fn is_in_subset(&self) -> bool
pub fn to_subset_unchecked(&self) -> SS
pub fn from_subset(element: &SS) -> SP
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,