[−][src]Struct markovian::prelude::Raw
Distribution over possibly infinte iterators.
Examples
With help of the raw_dist
macro, we construct a random variable that samples always a fixed value.
let value = 0; let dis = raw_dist![(1.0, value)]; assert_eq!(value, dis.sample(&mut thread_rng()));
Correctedness
Bounds on probabilities are checked only in debug mode using debug_assert
.
This way, there are guarantees when developing code that probabilities
have valid values, but during a release run there is no overhead!
Costs
Sample cost: O(iterator length). Construction cost: O(1).
Remarks
This struct is meant to be used when one needs to sample once from an infinte iterator.
Implementations
impl<I> Raw<I>
[src]
Trait Implementations
impl<I: Clone> Clone for Raw<I>
[src]
impl<I: Debug> Debug for Raw<I>
[src]
impl<P, T, I> Distribution<T> for Raw<I> where
P: Zero + One + PartialOrd + Debug + Copy,
f64: From<P>,
I: IntoIterator<Item = (P, T)> + Clone,
[src]
P: Zero + One + PartialOrd + Debug + Copy,
f64: From<P>,
I: IntoIterator<Item = (P, T)> + Clone,
fn sample<R: ?Sized>(&self, rng: &mut R) -> T where
R: Rng,
[src]
R: Rng,
fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T> where
R: Rng,
[src]
R: Rng,
impl<I: PartialEq> PartialEq<Raw<I>> for Raw<I>
[src]
impl<I> StructuralPartialEq for Raw<I>
[src]
Auto Trait Implementations
impl<I> RefUnwindSafe for Raw<I> where
I: RefUnwindSafe,
I: RefUnwindSafe,
impl<I> Send for Raw<I> where
I: Send,
I: Send,
impl<I> Sync for Raw<I> where
I: Sync,
I: Sync,
impl<I> Unpin for Raw<I> where
I: Unpin,
I: Unpin,
impl<I> UnwindSafe for Raw<I> where
I: UnwindSafe,
I: 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,
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> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
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.
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.
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>,