rgsl/randist/
dirichlet.rs

1//
2// A rust binding for the GSL library by Guillaume Gomez (guillaume1.gomez@gmail.com)
3//
4
5/// This function computes the probability density p(\theta_1, ... , \theta_K) at `theta[K]`
6/// for a Dirichlet distribution with parameters `alpha[K]`, using the formula given above.
7#[doc(alias = "gsl_ran_dirichlet_pdf")]
8pub fn dirichlet_pdf(alpha: &[f64], theta: &[f64]) -> f64 {
9    unsafe { sys::gsl_ran_dirichlet_pdf(alpha.len() as _, alpha.as_ptr(), theta.as_ptr()) }
10}
11
12/// This function computes the logarithm of the probability density p(\theta_1, ... , \theta_K)
13/// for a Dirichlet distribution with parameters `alpha[K]`.
14#[doc(alias = "gsl_ran_dirichlet_lnpdf")]
15pub fn dirichlet_lnpdf(alpha: &[f64], theta: &[f64]) -> f64 {
16    unsafe { sys::gsl_ran_dirichlet_lnpdf(alpha.len() as _, alpha.as_ptr(), theta.as_ptr()) }
17}