Struct rv::dist::LogNormal [−][src]
pub struct LogNormal { /* fields omitted */ }
LogNormal Distribution If x ~ Normal(μ, σ), then e^x ~ LogNormal(μ, σ).
Implementations
impl LogNormal
[src]
impl LogNormal
[src]pub fn new(mu: f64, sigma: f64) -> Result<Self, LogNormalError>
[src]
Create a new LogNormal distribution
Arguments
- mu: log scale mean
- sigma: log scale standard deviation
pub fn new_unchecked(mu: f64, sigma: f64) -> Self
[src]
Creates a new LogNormal without checking whether the parameters are valid.
pub fn standard() -> Self
[src]
LogNorma(0, 1)
Example
let lognormal = LogNormal::standard(); assert_eq!(lognormal, LogNormal::new(0.0, 1.0).unwrap());
pub fn mu(&self) -> f64
[src]
Get the mu parameter
Example
let lognormal = LogNormal::new(-1.0, 2.0).unwrap(); assert_eq!(lognormal.mu(), -1.0);
pub fn set_mu(&mut self, mu: f64) -> Result<(), LogNormalError>
[src]
Set the value of mu
Example
let mut lognormal = LogNormal::new(2.0, 1.5).unwrap(); assert_eq!(lognormal.mu(), 2.0); lognormal.set_mu(1.3).unwrap(); assert_eq!(lognormal.mu(), 1.3);
Will error for invalid values
assert!(lognormal.set_mu(1.3).is_ok()); assert!(lognormal.set_mu(std::f64::NEG_INFINITY).is_err()); assert!(lognormal.set_mu(std::f64::INFINITY).is_err()); assert!(lognormal.set_mu(std::f64::NAN).is_err());
pub fn set_mu_unchecked(&mut self, mu: f64)
[src]
Set the value of mu without input validation
pub fn sigma(&self) -> f64
[src]
Get the sigma parameter
Example
let lognormal = LogNormal::new(-1.0, 2.0).unwrap(); assert_eq!(lognormal.sigma(), 2.0);
pub fn set_sigma(&mut self, sigma: f64) -> Result<(), LogNormalError>
[src]
Set the value of sigma
Example
let mut lognormal = LogNormal::standard(); assert_eq!(lognormal.sigma(), 1.0); lognormal.set_sigma(2.3).unwrap(); assert_eq!(lognormal.sigma(), 2.3);
Will error for invalid values
assert!(lognormal.set_sigma(2.3).is_ok()); assert!(lognormal.set_sigma(0.0).is_err()); assert!(lognormal.set_sigma(-1.0).is_err()); assert!(lognormal.set_sigma(std::f64::INFINITY).is_err()); assert!(lognormal.set_sigma(std::f64::NEG_INFINITY).is_err()); assert!(lognormal.set_sigma(std::f64::NAN).is_err());
pub fn set_sigma_unchecked(&mut self, sigma: f64)
[src]
Set the value of sigma
Trait Implementations
impl ContinuousDistr<f32> for LogNormal
[src]
impl ContinuousDistr<f32> for LogNormal
[src]impl ContinuousDistr<f64> for LogNormal
[src]
impl ContinuousDistr<f64> for LogNormal
[src]impl InverseCdf<f32> for LogNormal
[src]
impl InverseCdf<f32> for LogNormal
[src]impl InverseCdf<f64> for LogNormal
[src]
impl InverseCdf<f64> for LogNormal
[src]impl StructuralPartialEq for LogNormal
[src]
impl StructuralPartialEq for LogNormal
[src]Auto Trait Implementations
impl RefUnwindSafe for LogNormal
impl RefUnwindSafe for LogNormal
impl UnwindSafe for LogNormal
impl UnwindSafe for LogNormal
Blanket Implementations
impl<T> Same<T> for T
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
pub fn to_subset(&self) -> Option<SS>
pub fn is_in_subset(&self) -> bool
pub fn to_subset_unchecked(&self) -> SS
pub fn from_subset(element: &SS) -> SP
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,