pub struct DistributionSampler { /* private fields */ }Expand description
Advanced distribution sampling utilities
Implementations§
Source§impl DistributionSampler
impl DistributionSampler
Sourcepub fn normal(&mut self, mean: f64, std: f64, n: usize) -> UtilsResult<Vec<f64>>
pub fn normal(&mut self, mean: f64, std: f64, n: usize) -> UtilsResult<Vec<f64>>
Sample from normal distribution
Sourcepub fn uniform(
&mut self,
low: f64,
high: f64,
n: usize,
) -> UtilsResult<Vec<f64>>
pub fn uniform( &mut self, low: f64, high: f64, n: usize, ) -> UtilsResult<Vec<f64>>
Sample from uniform distribution
Sourcepub fn beta(&mut self, alpha: f64, beta: f64, n: usize) -> UtilsResult<Vec<f64>>
pub fn beta(&mut self, alpha: f64, beta: f64, n: usize) -> UtilsResult<Vec<f64>>
Sample from beta distribution
Sourcepub fn gamma(
&mut self,
shape: f64,
scale: f64,
n: usize,
) -> UtilsResult<Vec<f64>>
pub fn gamma( &mut self, shape: f64, scale: f64, n: usize, ) -> UtilsResult<Vec<f64>>
Sample from gamma distribution
Sourcepub fn multivariate_normal_diag(
&mut self,
mean: &[f64],
variances: &[f64],
n: usize,
) -> UtilsResult<Vec<Vec<f64>>>
pub fn multivariate_normal_diag( &mut self, mean: &[f64], variances: &[f64], n: usize, ) -> UtilsResult<Vec<Vec<f64>>>
Sample from multivariate normal distribution (diagonal covariance)
Sourcepub fn truncated_normal(
&mut self,
mean: f64,
std: f64,
low: f64,
high: f64,
n: usize,
) -> UtilsResult<Vec<f64>>
pub fn truncated_normal( &mut self, mean: f64, std: f64, low: f64, high: f64, n: usize, ) -> UtilsResult<Vec<f64>>
Sample from truncated normal distribution
Sourcepub fn mixture_normal(
&mut self,
components: &[(f64, f64, f64)],
n: usize,
) -> UtilsResult<Vec<f64>>
pub fn mixture_normal( &mut self, components: &[(f64, f64, f64)], n: usize, ) -> UtilsResult<Vec<f64>>
Sample from mixture distribution
Auto Trait Implementations§
impl Freeze for DistributionSampler
impl RefUnwindSafe for DistributionSampler
impl Send for DistributionSampler
impl Sync for DistributionSampler
impl Unpin for DistributionSampler
impl UnwindSafe for DistributionSampler
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more