| Safe Haskell | None |
|---|---|
| Language | Haskell98 |
Data.Random.Distribution.Normal
- data Normal a
- normal :: Distribution Normal a => a -> a -> RVar a
- normalT :: Distribution Normal a => a -> a -> RVarT m a
- stdNormal :: Distribution Normal a => RVar a
- stdNormalT :: Distribution Normal a => RVarT m a
- doubleStdNormal :: RVarT m Double
- floatStdNormal :: RVarT m Float
- realFloatStdNormal :: (RealFloat a, Erf a, Distribution Uniform a) => RVarT m a
- normalTail :: (Distribution StdUniform a, Floating a, Ord a) => a -> RVarT m a
- normalPair :: (Floating a, Distribution StdUniform a) => RVar (a, a)
- boxMullerNormalPair :: (Floating a, Distribution StdUniform a) => RVar (a, a)
- knuthPolarNormalPair :: (Floating a, Ord a, Distribution Uniform a) => RVar (a, a)
Documentation
A specification of a normal distribution over the type a.
normal :: Distribution Normal a => a -> a -> RVar a Source #
normal m s is a random variable with distribution .Normal m s
normalT :: Distribution Normal a => a -> a -> RVarT m a Source #
normalT m s is a random process with distribution .Normal m s
stdNormalT :: Distribution Normal a => RVarT m a Source #
stdNormalT is a normal process with distribution StdNormal.
doubleStdNormal :: RVarT m Double Source #
A random variable sampling from the standard normal distribution
over the Double type.
floatStdNormal :: RVarT m Float Source #
A random variable sampling from the standard normal distribution
over the Float type.
realFloatStdNormal :: (RealFloat a, Erf a, Distribution Uniform a) => RVarT m a Source #
A random variable sampling from the standard normal distribution
over any RealFloat type (subject to the rest of the constraints -
it builds and uses a Ziggurat internally, which requires the Erf
class).
Because it computes a Ziggurat, it is very expensive to use for
just one evaluation, or even for multiple evaluations if not used and
reused monomorphically (to enable the ziggurat table to be let-floated
out). If you don't know whether your use case fits this description
then you're probably better off using a different algorithm, such as
boxMullerNormalPair or knuthPolarNormalPair. And of course if
you don't need the full generality of this definition then you're much
better off using doubleStdNormal or floatStdNormal.
As far as I know, this should be safe to use in any monomorphic
Distribution Normal instance declaration.
normalTail :: (Distribution StdUniform a, Floating a, Ord a) => a -> RVarT m a Source #
Draw from the tail of a normal distribution (the region beyond the provided value)
normalPair :: (Floating a, Distribution StdUniform a) => RVar (a, a) Source #
A random variable that produces a pair of independent normally-distributed values.
boxMullerNormalPair :: (Floating a, Distribution StdUniform a) => RVar (a, a) Source #
A random variable that produces a pair of independent
normally-distributed values, computed using the Box-Muller method.
This algorithm is slightly slower than Knuth's method but using a
constant amount of entropy (Knuth's method is a rejection method).
It is also slightly more general (Knuth's method require an Ord
instance).
knuthPolarNormalPair :: (Floating a, Ord a, Distribution Uniform a) => RVar (a, a) Source #
A random variable that produces a pair of independent
normally-distributed values, computed using Knuth's polar method.
Slightly faster than boxMullerNormalPair when it accepts on the
first try, but does not always do so.