Struct statrs::distribution::Laplace
source · [−]pub struct Laplace { /* private fields */ }Expand description
Implementations
Constructs a new laplace distribution with the given location and scale.
Errors
Returns an error if location or scale are NaN or scale <= 0.0
Examples
use statrs::distribution::Laplace;
let mut result = Laplace::new(0.0, 1.0);
assert!(result.is_ok());
result = Laplace::new(0.0, -1.0);
assert!(result.is_err());Returns the location of the laplace distribution
Examples
use statrs::distribution::Laplace;
let n = Laplace::new(0.0, 1.0).unwrap();
assert_eq!(n.location(), 0.0);Trait Implementations
Calculates the probability density function for the laplace
distribution at x
Formula
(1 / 2b) * exp(-|x - μ| / b)where μ is the location and b is the scale
Calculates the cumulative distribution function for the
laplace distribution at x
Formula
(1 / 2) * (1 + signum(x - μ)) - signum(x - μ) * exp(-|x - μ| / b)where μ is the location, b is the scale
Calculates the inverse cumulative distribution function for the
laplace distribution at p
Formula
if p <= 1/2
μ + b * ln(2p)if p >= 1/2
μ - b * ln(2 - 2p)where μ is the location, b is the scale
Generate a random value of T, using rng as the source of randomness.
Create an iterator that generates random values of T, using rng as
the source of randomness. Read more
Auto Trait Implementations
impl RefUnwindSafe for Laplace
impl UnwindSafe for Laplace
Blanket Implementations
Mutably borrows from an owned value. Read more
The inverse inclusion map: attempts to construct self from the equivalent element of its
superset. Read more
Checks if self is actually part of its subset T (and can be converted to it).
Use with care! Same as self.to_subset but without any property checks. Always succeeds.
The inclusion map: converts self to the equivalent element of its superset.