Struct rand_distr::Dirichlet
source · pub struct Dirichlet<F, const N: usize>where
F: Float,
StandardNormal: Distribution<F>,
Exp1: Distribution<F>,
Open01: Distribution<F>,{ /* private fields */ }
Available on crate feature
alloc
only.Expand description
The Dirichlet distribution Dirichlet(alpha)
.
The Dirichlet distribution is a family of continuous multivariate probability distributions parameterized by a vector alpha of positive reals. It is a multivariate generalization of the beta distribution.
Example
use rand::prelude::*;
use rand_distr::Dirichlet;
let dirichlet = Dirichlet::new([1.0, 2.0, 3.0]).unwrap();
let samples = dirichlet.sample(&mut rand::thread_rng());
println!("{:?} is from a Dirichlet([1.0, 2.0, 3.0]) distribution", samples);
Implementations§
source§impl<F, const N: usize> Dirichlet<F, N>where
F: Float,
StandardNormal: Distribution<F>,
Exp1: Distribution<F>,
Open01: Distribution<F>,
impl<F, const N: usize> Dirichlet<F, N>where F: Float, StandardNormal: Distribution<F>, Exp1: Distribution<F>, Open01: Distribution<F>,
Trait Implementations§
source§impl<F, const N: usize> Clone for Dirichlet<F, N>where
F: Float + Clone,
StandardNormal: Distribution<F>,
Exp1: Distribution<F>,
Open01: Distribution<F>,
impl<F, const N: usize> Clone for Dirichlet<F, N>where F: Float + Clone, StandardNormal: Distribution<F>, Exp1: Distribution<F>, Open01: Distribution<F>,
source§impl<F, const N: usize> Debug for Dirichlet<F, N>where
F: Float + Debug,
StandardNormal: Distribution<F>,
Exp1: Distribution<F>,
Open01: Distribution<F>,
impl<F, const N: usize> Debug for Dirichlet<F, N>where F: Float + Debug, StandardNormal: Distribution<F>, Exp1: Distribution<F>, Open01: Distribution<F>,
source§impl<F, const N: usize> Distribution<[F; N]> for Dirichlet<F, N>where
F: Float,
StandardNormal: Distribution<F>,
Exp1: Distribution<F>,
Open01: Distribution<F>,
impl<F, const N: usize> Distribution<[F; N]> for Dirichlet<F, N>where F: Float, StandardNormal: Distribution<F>, Exp1: Distribution<F>, Open01: Distribution<F>,
source§fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> [F; N]
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> [F; N]
Generate a random value of
T
, using rng
as the source of randomness.source§impl<F, const N: usize> PartialEq<Dirichlet<F, N>> for Dirichlet<F, N>where
F: Float + PartialEq,
StandardNormal: Distribution<F>,
Exp1: Distribution<F>,
Open01: Distribution<F>,
impl<F, const N: usize> PartialEq<Dirichlet<F, N>> for Dirichlet<F, N>where F: Float + PartialEq, StandardNormal: Distribution<F>, Exp1: Distribution<F>, Open01: Distribution<F>,
impl<F, const N: usize> StructuralPartialEq for Dirichlet<F, N>where F: Float, StandardNormal: Distribution<F>, Exp1: Distribution<F>, Open01: Distribution<F>,
Auto Trait Implementations§
impl<F, const N: usize> RefUnwindSafe for Dirichlet<F, N>where F: RefUnwindSafe,
impl<F, const N: usize> Send for Dirichlet<F, N>where F: Send,
impl<F, const N: usize> Sync for Dirichlet<F, N>where F: Sync,
impl<F, const N: usize> Unpin for Dirichlet<F, N>where F: Unpin,
impl<F, const N: usize> UnwindSafe for Dirichlet<F, N>where F: UnwindSafe,
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