pub struct Distribution1D { /* private fields */ }Expand description
A 1d distribution
Implementations§
Source§impl Distribution1D
impl Distribution1D
Sourcepub fn new<I>(func: I) -> Distribution1Dwhere
I: IntoIterator<Item = Float>,
pub fn new<I>(func: I) -> Distribution1Dwhere
I: IntoIterator<Item = Float>,
construction
Sourcepub fn sample_continuous(&self, u: Float) -> (Float, Float, usize)
pub fn sample_continuous(&self, u: Float) -> (Float, Float, usize)
given a uniform sample in $[0, 1)$, return
a sample as (value, pdf, offset)
Sourcepub fn sample_discrete(&self, u: Float) -> (usize, Float, Float)
pub fn sample_discrete(&self, u: Float) -> (usize, Float, Float)
giben a uniform sample in $[0, 1)$, return
a discrete sample as (offset, pdf, remapped_value)
pub fn discrete_pdf(&self, index: usize) -> Float
Trait Implementations§
Source§impl Debug for Distribution1D
impl Debug for Distribution1D
Source§impl<'de> Deserialize<'de> for Distribution1D
impl<'de> Deserialize<'de> for Distribution1D
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl FromIterator<f32> for Distribution1D
impl FromIterator<f32> for Distribution1D
Auto Trait Implementations§
impl Freeze for Distribution1D
impl RefUnwindSafe for Distribution1D
impl Send for Distribution1D
impl Sync for Distribution1D
impl Unpin for Distribution1D
impl UnwindSafe for Distribution1D
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> 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