boltzmann-samplers-0.1.0.0: Uniform random generators
Boltzmann.Data.Common
Description
General helper functions
Synopsis
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.
partitions k n
n
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]