pub struct LogNormalMixtureSampler { /* private fields */ }Expand description
Log-Normal Mixture Model sampler for positive-only distributions.
Implementations§
Source§impl LogNormalMixtureSampler
impl LogNormalMixtureSampler
Sourcepub fn new(seed: u64, config: LogNormalMixtureConfig) -> Result<Self, String>
pub fn new(seed: u64, config: LogNormalMixtureConfig) -> Result<Self, String>
Create a new Log-Normal mixture sampler.
Sourcepub fn sample_decimal(&mut self) -> Decimal
pub fn sample_decimal(&mut self) -> Decimal
Sample a value as Decimal.
Sourcepub fn sample_with_component(&mut self) -> SampleWithComponent
pub fn sample_with_component(&mut self) -> SampleWithComponent
Sample a value with component information.
Sourcepub fn sample_n_decimal(&mut self, n: usize) -> Vec<Decimal>
pub fn sample_n_decimal(&mut self, n: usize) -> Vec<Decimal>
Sample multiple values as Decimals.
Sourcepub fn config(&self) -> &LogNormalMixtureConfig
pub fn config(&self) -> &LogNormalMixtureConfig
Get the configuration.
Sourcepub fn expected_value(&self) -> f64
pub fn expected_value(&self) -> f64
Get the expected value of the mixture.
Sourcepub fn ppf(&self, u: f64) -> f64
pub fn ppf(&self, u: f64) -> f64
v4.1.6+: inverse CDF (quantile) for the mixture, computed via
bisection. Given u ∈ (0, 1) returns the value x such that
F(x) = u, where F is the mixture CDF (weighted sum of the
component log-normal CDFs). Result is clamped to
[min_value, max_value] and rounded to decimal_places.
Sourcepub fn ppf_decimal(&self, u: f64) -> Decimal
pub fn ppf_decimal(&self, u: f64) -> Decimal
v4.1.6+: inverse CDF as Decimal.
Trait Implementations§
Source§impl Clone for LogNormalMixtureSampler
impl Clone for LogNormalMixtureSampler
Source§fn clone(&self) -> LogNormalMixtureSampler
fn clone(&self) -> LogNormalMixtureSampler
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for LogNormalMixtureSampler
impl RefUnwindSafe for LogNormalMixtureSampler
impl Send for LogNormalMixtureSampler
impl Sync for LogNormalMixtureSampler
impl Unpin for LogNormalMixtureSampler
impl UnsafeUnpin for LogNormalMixtureSampler
impl UnwindSafe for LogNormalMixtureSampler
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