random-fu-0.0.3: Random number generationSource codeContentsIndex
Data.Random.Distribution.Discrete
Synopsis
discrete :: Distribution (Discrete p) a => [(p, a)] -> RVar a
empirical :: (Num p, Ord a) => [a] -> Discrete p a
newtype Discrete p a = Discrete [(p, a)]
mapDiscreteWeights :: (p -> q) -> Discrete p e -> Discrete q e
normalizeDiscreteWeights :: Fractional p => Discrete p e -> Discrete p e
collectDiscreteEvents :: (Ord e, Num p, Ord p) => Discrete p e -> Discrete p e
collectDiscreteEventsBy :: (e -> e -> Ordering) -> ([p] -> p) -> ([e] -> e) -> Discrete p e -> Discrete p e
Documentation
discrete :: Distribution (Discrete p) a => [(p, a)] -> RVar aSource
empirical :: (Num p, Ord a) => [a] -> Discrete p aSource
newtype Discrete p a Source
Constructors
Discrete [(p, a)]
show/hide Instances
mapDiscreteWeights :: (p -> q) -> Discrete p e -> Discrete q eSource
Like fmap, but for the weights of a discrete distribution.
normalizeDiscreteWeights :: Fractional p => Discrete p e -> Discrete p eSource
Adjust all the weights of a discrete distribution so that they sum to unity. If not possible, returns the original distribution unchanged.
collectDiscreteEvents :: (Ord e, Num p, Ord p) => Discrete p e -> Discrete p eSource
Simplify a discrete distribution by combining equivalent events (the new event will have a weight equal to the sum of all the originals).
collectDiscreteEventsBy :: (e -> e -> Ordering) -> ([p] -> p) -> ([e] -> e) -> Discrete p e -> Discrete p eSource
Simplify a discrete distribution by combining equivalent events (the new event will have a weight equal to the sum of all the originals). The comparator function is used to identify events to combine. Once chosen, the events and their weights are combined (independently) by the provided weight and event aggregation functions.
Produced by Haddock version 2.4.2