0 | module Statistics.Distribution.Dirichlet
2 | import Statistics.Distribution.GSL
3 | import Statistics.Distribution.Gamma
7 | %foreign "C:gsl_ran_dirichlet,libgsl"
8 | gsl_dirichlet_c : (seed : AnyPtr) -> (size : Int) -> (alphas : AnyPtr) -> (output : AnyPtr) -> PrimIO ()
11 | gsl_dirichlet : {n : Nat} -> (alphas : Vect (S n) Double) -> GslRng -> IO (Vect (S n) Double)
12 | gsl_dirichlet alphas (MkGslRng seed) = do
13 | let alphas_ptr = to_array alphas
14 | output_ptr = init_array (S n)
15 | primIO $
gsl_dirichlet_c seed (cast $
S n) alphas_ptr output_ptr
16 | pure (from_array output_ptr)
19 | %foreign "C:gsl_ran_dirichlet_pdf,libgsl"
20 | gsl_dirichlet_pdf_c : (size : Int) -> (alphas : AnyPtr) -> (obs : AnyPtr) -> Double
23 | gsl_dirichlet_pdf : {n : Nat} -> (alphas : Vect (S n) Double) -> (obs : Vect (S n) Double) -> Double
24 | gsl_dirichlet_pdf alphas ys =
25 | let alphas_ptr = to_array alphas
26 | ys_ptr = to_array ys
27 | in gsl_dirichlet_pdf_c (cast $
S n) alphas_ptr ys_ptr