Struct uncertain::Distribution [−][src]
Wraps a Distribution
and implements
Uncertain
.
Uncertain values need to observe the correct epoch
semantics if
they implement Copy
or Clone
, or want to implement Uncertain
for references.
Since most uncertain values model distributions but distributions
themselves do not require any special epoch
semantics when they can be Cloned
or
are implemented on references, this wrapper type exists.
See Uncertain::sample
for more details on the required semantics.
Examples
Basic usage:
use uncertain::{Uncertain, Distribution}; use rand_distr::StandardNormal; let x = Distribution::from(StandardNormal); assert!(x.map(|x: f64| x.abs() < 1.0).pr(0.68));
Trait Implementations
impl<T, D> From<D> for Distribution<T, D> where
D: Distribution<T>,
[src]
D: Distribution<T>,
impl<T, D> Uncertain for Distribution<T, D> where
D: Distribution<T>,
[src]
D: Distribution<T>,
type Value = T
The type of the contained value.
fn sample(&self, rng: &mut Pcg32, _epoch: usize) -> Self::Value
[src]
fn pr(&self, probability: f32) -> bool where
Self::Value: Into<bool>,
[src]
Self::Value: Into<bool>,
fn expect(
&self,
precision: Self::Value
) -> Result<Self::Value, ConvergenceError<Self::Value>> where
Self::Value: Float,
[src]
&self,
precision: Self::Value
) -> Result<Self::Value, ConvergenceError<Self::Value>> where
Self::Value: Float,
fn into_boxed(self) -> BoxedUncertain<Self::Value> where
Self: 'static + Sized + Send,
[src]
Self: 'static + Sized + Send,
fn into_ref(self) -> RefUncertain<Self> where
Self: Sized,
Self::Value: Clone,
[src]
Self: Sized,
Self::Value: Clone,
fn map<O, F>(self, func: F) -> Map<Self, F> where
Self: Sized,
F: Fn(Self::Value) -> O,
[src]
Self: Sized,
F: Fn(Self::Value) -> O,
fn flat_map<O, F>(self, func: F) -> FlatMap<Self, F> where
Self: Sized,
O: Uncertain,
F: Fn(Self::Value) -> O,
[src]
Self: Sized,
O: Uncertain,
F: Fn(Self::Value) -> O,
fn join<O, U, F>(self, other: U, func: F) -> Join<Self, U, F> where
Self: Sized,
U: Uncertain,
F: Fn(Self::Value, U::Value) -> O,
[src]
Self: Sized,
U: Uncertain,
F: Fn(Self::Value, U::Value) -> O,
fn not(self) -> Not<Self> where
Self: Sized,
Self::Value: Into<bool>,
[src]
Self: Sized,
Self::Value: Into<bool>,
fn and<U>(self, other: U) -> And<Self, U> where
Self: Sized,
Self::Value: Into<bool>,
U: Uncertain,
U::Value: Into<bool>,
[src]
Self: Sized,
Self::Value: Into<bool>,
U: Uncertain,
U::Value: Into<bool>,
fn or<U>(self, other: U) -> Or<Self, U> where
Self: Sized,
Self::Value: Into<bool>,
U: Uncertain,
U::Value: Into<bool>,
[src]
Self: Sized,
Self::Value: Into<bool>,
U: Uncertain,
U::Value: Into<bool>,
fn add<U>(self, other: U) -> Sum<Self, U> where
Self: Sized,
U: Uncertain,
Self::Value: Add<U::Value>,
[src]
Self: Sized,
U: Uncertain,
Self::Value: Add<U::Value>,
fn sub<U>(self, other: U) -> Difference<Self, U> where
Self: Sized,
U: Uncertain,
Self::Value: Sub<U::Value>,
[src]
Self: Sized,
U: Uncertain,
Self::Value: Sub<U::Value>,
fn mul<U>(self, other: U) -> Product<Self, U> where
Self: Sized,
U: Uncertain,
Self::Value: Mul<U::Value>,
[src]
Self: Sized,
U: Uncertain,
Self::Value: Mul<U::Value>,
fn div<U>(self, other: U) -> Ratio<Self, U> where
Self: Sized,
U: Uncertain,
Self::Value: Div<U::Value>,
[src]
Self: Sized,
U: Uncertain,
Self::Value: Div<U::Value>,
Auto Trait Implementations
impl<T, D> RefUnwindSafe for Distribution<T, D> where
D: RefUnwindSafe,
T: RefUnwindSafe,
D: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, D> Send for Distribution<T, D> where
D: Send,
T: Send,
D: Send,
T: Send,
impl<T, D> Sync for Distribution<T, D> where
D: Sync,
T: Sync,
D: Sync,
T: Sync,
impl<T, D> Unpin for Distribution<T, D> where
D: Unpin,
T: Unpin,
D: Unpin,
T: Unpin,
impl<T, D> UnwindSafe for Distribution<T, D> where
D: UnwindSafe,
T: UnwindSafe,
D: UnwindSafe,
T: UnwindSafe,
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<!> for 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, 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>,