pub struct TruncatedNormal<T>where
StandardNormal: Distribution<T>,{ /* private fields */ }
Expand description
The TruncatedNormal
distribution is similar to the StandardNormal
distribution,
differing in that is computes a boundary equal to two standard deviations from the mean.
More formally, the boundary is defined as:
\text{boundary} = \mu + 2\sigma
Implementations§
Source§impl<T> TruncatedNormal<T>
impl<T> TruncatedNormal<T>
Sourcepub const fn new(mean: T, std: T) -> Result<TruncatedNormal<T>, InitError>
pub const fn new(mean: T, std: T) -> Result<TruncatedNormal<T>, InitError>
create a new TruncatedNormal
distribution with the given mean and standard
deviation; both of which are type T
.
Sourcepub fn boundary(&self) -> Twhere
T: Float,
pub fn boundary(&self) -> Twhere
T: Float,
compute the boundary of the truncated normal distribution which is two standard deviations from the mean: $$ \text{boundary} = \mu + 2\sigma $$
Trait Implementations§
Source§impl<T> Clone for TruncatedNormal<T>
impl<T> Clone for TruncatedNormal<T>
Source§fn clone(&self) -> TruncatedNormal<T>
fn clone(&self) -> TruncatedNormal<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<T> Debug for TruncatedNormal<T>
impl<T> Debug for TruncatedNormal<T>
Source§impl<T> Distribution<T> for TruncatedNormal<T>
impl<T> Distribution<T> for TruncatedNormal<T>
Source§impl<T> From<Normal<T>> for TruncatedNormal<T>
impl<T> From<Normal<T>> for TruncatedNormal<T>
Source§fn from(normal: Normal<T>) -> TruncatedNormal<T>
fn from(normal: Normal<T>) -> TruncatedNormal<T>
Converts to this type from the input type.
Source§impl<T> Hash for TruncatedNormal<T>
impl<T> Hash for TruncatedNormal<T>
Source§impl<T> Ord for TruncatedNormal<T>
impl<T> Ord for TruncatedNormal<T>
Source§fn cmp(&self, other: &TruncatedNormal<T>) -> Ordering
fn cmp(&self, other: &TruncatedNormal<T>) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<T> PartialEq for TruncatedNormal<T>
impl<T> PartialEq for TruncatedNormal<T>
Source§impl<T> PartialOrd for TruncatedNormal<T>
impl<T> PartialOrd for TruncatedNormal<T>
impl<T> Copy for TruncatedNormal<T>
impl<T> Eq for TruncatedNormal<T>
impl<T> StructuralPartialEq for TruncatedNormal<T>where
StandardNormal: Distribution<T>,
Auto Trait Implementations§
impl<T> Freeze for TruncatedNormal<T>where
T: Freeze,
impl<T> RefUnwindSafe for TruncatedNormal<T>where
T: RefUnwindSafe,
impl<T> Send for TruncatedNormal<T>where
T: Send,
impl<T> Sync for TruncatedNormal<T>where
T: Sync,
impl<T> Unpin for TruncatedNormal<T>where
T: Unpin,
impl<T> UnwindSafe for TruncatedNormal<T>where
T: UnwindSafe,
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> CallInPlace<T> for Twhere
T: CallInto<T>,
impl<T> CallInPlace<T> for Twhere
T: CallInto<T>,
Source§fn call_inplace<F>(&mut self, f: F) -> <T as CallInto<T>>::Output
fn call_inplace<F>(&mut self, f: F) -> <T as CallInto<T>>::Output
The
call_on_mut
method allows an object to be passed onto a function that takes a mutable reference
to the object. This is useful for cases where you want to perform an operation on
an object and mutate it in the process.Source§impl<T> CallInto<T> for T
impl<T> CallInto<T> for T
Source§impl<T> CallOn<T> for Twhere
T: CallInto<T>,
impl<T> CallOn<T> for Twhere
T: CallInto<T>,
Source§fn call_on<F>(&self, f: F) -> <T as CallInto<T>>::Output
fn call_on<F>(&self, f: F) -> <T as CallInto<T>>::Output
The
call_on
method allows an object to be passed onto a function that takes a reference
to the object. This is useful for cases where you want to perform an operation on
an object without needing to extract it from a container or context.