boltzmann-samplers-0.1.0.0: Uniform random generators

Safe HaskellSafe
LanguageHaskell2010

Boltzmann.Data.Common

Description

General helper functions

Synopsis

Documentation

frequencyWith :: (Ord r, Num r, Monad m) => (r -> m r) -> [(r, m a)] -> m a Source #

partitions :: Int -> Int -> [[Int]] Source #

partitions k n: lists of non-negative integers of length n with sum less than or equal to k.

binomial :: Int -> Int -> Integer Source #

Binomial coefficient.

binomial n k == factorial n `div` (factorial k * factorial (n-k))

multinomial :: Int -> [Int] -> Integer Source #

Multinomial coefficient.

multinomial n ps == factorial n `div` product [factorial p | p <- ps]