Struct rv::dist::Exponential [−][src]
pub struct Exponential { /* fields omitted */ }
Exponential distribution, Exp(λ) over x in [0, ∞).
Examples
Compute 50% confidence interval
use rv::prelude::*; let expon = Exponential::new(1.5).unwrap(); let interval: (f64, f64) = expon.interval(0.5); // (0.19, 0.92)
Implementations
impl Exponential
[src]
impl Exponential
[src]pub fn new(rate: f64) -> Result<Self, ExponentialError>
[src]
pub fn new_unchecked(rate: f64) -> Self
[src]
Creates a new Exponential without checking whether the parameter is valid.
pub fn rate(&self) -> f64
[src]
Get the rate parameter
Example
let expon = Exponential::new(1.3).unwrap(); assert_eq!(expon.rate(), 1.3);
pub fn set_rate(&mut self, rate: f64) -> Result<(), ExponentialError>
[src]
Set the rate parameter
Example
let mut expon = Exponential::new(1.3).unwrap(); assert_eq!(expon.rate(), 1.3); expon.set_rate(2.1).unwrap(); assert_eq!(expon.rate(), 2.1);
Will error for invalid values
assert!(expon.set_rate(2.1).is_ok()); assert!(expon.set_rate(0.1).is_ok()); assert!(expon.set_rate(0.0).is_err()); assert!(expon.set_rate(-1.0).is_err()); assert!(expon.set_rate(std::f64::INFINITY).is_err()); assert!(expon.set_rate(std::f64::NEG_INFINITY).is_err()); assert!(expon.set_rate(std::f64::NAN).is_err());
pub fn set_rate_unchecked(&mut self, rate: f64)
[src]
Set the rate parameter without input validation
Trait Implementations
impl Clone for Exponential
[src]
impl Clone for Exponential
[src]fn clone(&self) -> Exponential
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl ContinuousDistr<f32> for Exponential
[src]
impl ContinuousDistr<f32> for Exponential
[src]impl ContinuousDistr<f64> for Exponential
[src]
impl ContinuousDistr<f64> for Exponential
[src]impl InverseCdf<f32> for Exponential
[src]
impl InverseCdf<f32> for Exponential
[src]impl InverseCdf<f64> for Exponential
[src]
impl InverseCdf<f64> for Exponential
[src]impl KlDivergence for Exponential
[src]
impl KlDivergence for Exponential
[src]impl PartialEq<Exponential> for Exponential
[src]
impl PartialEq<Exponential> for Exponential
[src]fn eq(&self, other: &Exponential) -> bool
[src]
fn ne(&self, other: &Exponential) -> bool
[src]
impl Rv<f32> for Exponential
[src]
impl Rv<f32> for Exponential
[src]impl Rv<f64> for Exponential
[src]
impl Rv<f64> for Exponential
[src]impl StructuralPartialEq for Exponential
[src]
impl StructuralPartialEq for Exponential
[src]Auto Trait Implementations
impl RefUnwindSafe for Exponential
impl RefUnwindSafe for Exponential
impl Send for Exponential
impl Send for Exponential
impl Sync for Exponential
impl Sync for Exponential
impl Unpin for Exponential
impl Unpin for Exponential
impl UnwindSafe for Exponential
impl UnwindSafe for Exponential
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>,