pub struct Weighted<S, W = f64>(pub S, pub W);Expand description
Represents a weighted sample.
Tuple Fields§
§0: SThe value.
1: WThe weight.
Trait Implementations§
impl<S: Copy, W: Copy> Copy for Weighted<S, W>
impl<S: Eq, W: Eq> Eq for Weighted<S, W>
Source§impl<S: PartialEq, W: PartialEq> PartialEq for Weighted<S, W>
impl<S: PartialEq, W: PartialEq> PartialEq for Weighted<S, W>
impl<S: PartialEq, W: PartialEq> StructuralPartialEq for Weighted<S, W>
Source§impl<S: Sample, W: Sample + Add<Output = W>> Weighable for Weighted<S, W>
impl<S: Sample, W: Sample + Add<Output = W>> Weighable for Weighted<S, W>
Source§type Error = NegativeWeight<W>
type Error = NegativeWeight<W>
The error-type in case sampling fails.
Source§fn sample<const M: usize>(
self,
rv: &RandomVariable<Self, M>,
) -> Result<(), Self::Error>where
CentralMoments<M>: Univariate,
fn sample<const M: usize>(
self,
rv: &RandomVariable<Self, M>,
) -> Result<(), Self::Error>where
CentralMoments<M>: Univariate,
Adds this value to the collection of values represented by the random
variable.
Auto Trait Implementations§
impl<S, W> Freeze for Weighted<S, W>
impl<S, W> RefUnwindSafe for Weighted<S, W>where
S: RefUnwindSafe,
W: RefUnwindSafe,
impl<S, W> Send for Weighted<S, W>
impl<S, W> Sync for Weighted<S, W>
impl<S, W> Unpin for Weighted<S, W>
impl<S, W> UnsafeUnpin for Weighted<S, W>where
S: UnsafeUnpin,
W: UnsafeUnpin,
impl<S, W> UnwindSafe for Weighted<S, W>where
S: UnwindSafe,
W: 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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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