Skip to main content

DensityChain

Struct DensityChain 

Source
pub struct DensityChain<S, D>
where D: Density<S>,
{ /* private fields */ }
Expand description

Applies a function to the output of Density::probability. See Density::chain.

Trait Implementations§

Source§

impl<S, D> Density<S> for DensityChain<S, D>
where D: Density<S>,

Source§

fn probability(&mut self, s: &S, c: &[S]) -> f64

Defines the probability of each instance s of S. This probability can be dependend on the previously chosen instances of S and are passed with c.
Source§

fn chain<F: FnMut(f64) -> f64 + 'static>(self, func: F) -> DensityChain<S, Self>
where Self: Sized,

Applies the given function func to each probability computed by Density::probability.
Source§

fn transform<F: FnMut(S) -> S + 'static>( self, func: F, ) -> DensityTransformer<S, Self>
where S: Clone, Self: Sized,

Each time DensityTransformer::probability is called, the given function func is applied to the input and the previously chosen instances of S.
Source§

fn add<DD: Density<S>>(self, density: DD) -> DensityAdd<S, Self, DD>
where Self: Sized,

Add Densitys. Every value of the first and second densities are added together.
Source§

fn sub<DD: Density<S>>(self, density: DD) -> DensitySub<S, Self, DD>
where Self: Sized,

Subtract Densitys. Every value of the second density is subtracted from the value of the first density.
Source§

fn mul<DD: Density<S>>(self, density: DD) -> DensityMul<S, Self, DD>
where Self: Sized,

Multiplies Densitys. Every value of the first density is multiplied with the value of the second density.
Source§

fn div<DD: Density<S>>(self, density: DD) -> DensityDiv<S, Self, DD>
where Self: Sized,

Divides Densitys. Every value of the first density is divided by the value of the second density.
Source§

fn max<DD: Density<S>>(self, density: DD) -> DensityMax<S, Self, DD>
where Self: Sized,

Takes the maximum value of Densitys.
Source§

fn min<DD: Density<S>>(self, density: DD) -> DensityMin<S, Self, DD>
where Self: Sized,

Takes the minimum value of Densitys.

Auto Trait Implementations§

§

impl<S, D> Freeze for DensityChain<S, D>
where D: Freeze,

§

impl<S, D> !RefUnwindSafe for DensityChain<S, D>

§

impl<S, D> !Send for DensityChain<S, D>

§

impl<S, D> !Sync for DensityChain<S, D>

§

impl<S, D> Unpin for DensityChain<S, D>
where D: Unpin, S: Unpin,

§

impl<S, D> UnsafeUnpin for DensityChain<S, D>
where D: UnsafeUnpin,

§

impl<S, D> !UnwindSafe for DensityChain<S, D>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<D> ShowContour for D
where D: Density<[f64; 2]>,

Source§

fn show_contour( self, x_min: f64, x_max: f64, y_min: f64, y_max: f64, choose_points: &[[f64; 2]], )

Shows a contour plot of the specified region for a Density over Points. This function uses a matplotlib backend and spawns a window to interspect the plot.

Arguments:

  • choose_vertices: Points which should be passed to the Density as previously chosen
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V