-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Bindings the the GSL random number generation facilities. -- -- Bindings to the GNU Scientific Library random and quasi-random number -- generators and random distributions. @package gsl-random @version 0.4 -- | Quasi-random number generators. module GSL.Random.Quasi newtype QRNG MkQRNG :: (ForeignPtr QRNG) -> QRNG data QRNGType -- | Allocate a new quasi-random number generator of the given type, -- generating points with the given number of dimensions. newQRNG :: QRNGType -> Int -> IO QRNG -- | Reset the generator to the beginning of its sequence. resetQRNG :: QRNG -> IO () -- | Stores the next point from the generator in the given buffer. The -- space available in the buffer must match the dimension of the -- generator. The components of the sample will each lie in the range -- (0,1). getSample :: QRNG -> Ptr Double -> IO () -- | Gets the next sample point as a list. getListSample :: QRNG -> IO [Double] -- | Get the name of the generator. getName :: QRNG -> IO String -- | The dimension of the sequence. getDimension :: QRNG -> IO Int -- | Get the size of the generator state, in bytes. getSize :: QRNG -> IO Word64 -- | Get the generator state. getState :: QRNG -> IO [Word8] -- | Set the generator state. The input array should have size equal to -- getSize of the generator; otherwise, strange things will -- happen. setState :: QRNG -> [Word8] -> IO () -- | copyQRNG dst src copies the state from one generator to -- another. The two generators must have the same type. copyQRNG :: QRNG -> QRNG -> IO () -- | Allocate a new quasi-random number generator that is exact copy of -- another generator. cloneQRNG :: QRNG -> IO QRNG niederreiter :: QRNGType sobol :: QRNGType halton :: QRNGType reverseHalton :: QRNGType -- | The maximum dimension of samples that the given generator supports. maxDimension :: QRNGType -> Int -- | Random number distributions. Functions for generating random variates -- and computing their probability distributions. module GSL.Random.Dist -- | gaussianPdf x sigma computes the probabililty density p(x) -- for a Gaussian distribution with mean 0 and standard -- deviation sigma. gaussianPdf :: Double -> Double -> Double -- | gaussianP x sigma computes the cumulative distribution -- function P(x) for a Gaussian distribution with mean 0 and -- standard deviation sigma. gaussianP :: Double -> Double -> Double -- | gaussianQ x sigma computes the cumulative distribution -- function Q(x) for a Gaussian distribution with mean 0 and -- standard deviation sigma. gaussianQ :: Double -> Double -> Double -- | gaussianPInv p sigma computes the inverse of the cumulative -- distribution function of a Gaussian distribution with mean 0 -- and standard deviation sigma. It returns x such that -- P(x) = p. gaussianPInv :: Double -> Double -> Double -- | gaussianPInv q sigma computes the inverse of the cumulative -- distribution function of a Gaussian distribution with mean 0 -- and standard deviation sigma. It returns x such that -- Q(x) = q. gaussianQInv :: Double -> Double -> Double -- | getGaussian r sigma gets a normal random variable with mean -- 0 and standard deviation sigma. This uses the -- Box-Mueller algorithm. getGaussian :: RNG -> Double -> IO Double -- | getGaussianZiggurat r sigma gets a normal random variable -- with mean 0 and standard deviation sigma. This uses -- the Marsaglia-Tsang ziggurat algorithm. getGaussianZiggurat :: RNG -> Double -> IO Double -- | getGaussianRatioMethod r sigma gets a normal random variable -- with mean 0 and standard deviation sigma. This uses -- the Kinderman-Monahan-Leva ratio method. getGaussianRatioMethod :: RNG -> Double -> IO Double -- | ugaussianPdf x computes the probabililty density p(x) for a -- Gaussian distribution with mean 0 and standard deviation -- 1. ugaussianPdf :: Double -> Double -- | ugaussianP x computes the cumulative distribution function -- P(x) for a Gaussian distribution with mean 0 and standard -- deviation 1. ugaussianP :: Double -> Double -- | ugaussianQ x computes the cumulative distribution function -- Q(x) for a Gaussian distribution with mean 0 and standard -- deviation 1. ugaussianQ :: Double -> Double -- | ugaussianPInv p computes the inverse of the cumulative -- distribution function of a Gaussian distribution with mean 0 -- and standard deviation 1. It returns x such that -- P(x) = p. ugaussianPInv :: Double -> Double -- | ugaussianPInv q computes the inverse of the cumulative -- distribution function of a Gaussian distribution with mean 0 -- and standard deviation 1. It returns x such that -- Q(x) = q. ugaussianQInv :: Double -> Double -- | getUGaussian r gets a normal random variable with mean -- 0 and standard deviation 1. This uses the -- Box-Mueller algorithm. getUGaussian :: RNG -> IO Double -- | getUGaussianRatioMethod r gets a normal random variable with -- mean 0 and standard deviation 1. This uses the -- Kinderman-Monahan-Leva ratio method. getUGaussianRatioMethod :: RNG -> IO Double -- | flatPdf x a b computes the probability density p(x) -- at x for a uniform distribution from a to -- b. flatPdf :: Double -> Double -> Double -> Double -- | flatP x a b computes the cumulative distribution function -- P(x). flatP :: Double -> Double -> Double -> Double -- | flatQ x a b computes the cumulative distribution function -- Q(x). flatQ :: Double -> Double -> Double -> Double -- | flatPInv p a b computes the inverse of the cumulative -- distribution and returns x so that function P(x) = -- p. flatPInv :: Double -> Double -> Double -> Double -- | flatQInv q a b computes the inverse of the cumulative -- distribution and returns x so that function Q(x) = -- q. flatQInv :: Double -> Double -> Double -> Double -- | getFlat r a b gets a value uniformly chosen in -- [a,b). getFlat :: RNG -> Double -> Double -> IO (Double) -- | exponentialPdf x mu computes the density at x of an -- exponential with mean mu. exponentialPdf :: Double -> Double -> Double exponentialP :: Double -> Double -> Double exponentialQ :: Double -> Double -> Double exponentialPInv :: Double -> Double -> Double exponentialQInv :: Double -> Double -> Double -- | getExponential r mu gets a random exponential with mean -- mu. getExponential :: RNG -> Double -> IO Double -- | getLevy r c alpha gets a variate from the Levy symmetric -- stable distribution with scale c and exponent alpha. -- The algorithm only works for 0 <= alpha <= 2. getLevy :: RNG -> Double -> Double -> IO (Double) -- | getLevySkew r c alpha beta gets a variate from the Levy skew -- stable distribution with scale c, exponent alpha, -- and skewness parameter beta. The skewness parameter must lie -- in the range [-1,1]. The algorithm only works for 0 <= -- alpha <= 2. getLevySkew :: RNG -> Double -> Double -> Double -> IO (Double) -- | poissonPdf k mu evaluates the probability density -- p(k) at k for a Poisson distribution with mean -- mu. poissonPdf :: Int -> Double -> Double -- | poissonP k mu evaluates the cumulative distribution function -- P(k) at k for a Poisson distribution with mean -- mu. poissonP :: Int -> Double -> Double -- | poissonQ k mu evaluates the cumulative distribution function -- Q(k) at k for a Poisson distribution with mean -- mu. poissonQ :: Int -> Double -> Double -- | getPoisson r mu gets a poisson random variable with mean -- mu. getPoisson :: RNG -> Double -> IO Int -- | getCauchy r a gets a random cauchy with scale a. getCauchy :: RNG -> Double -> IO Double -- | cauchyPdf x a evaluates the probability density p(x) -- at x for a Cauchy distribution with scale parameter -- a. The density is given by p(x) dx = { 1 over api (1 + -- (x/a^2)) } dx. cauchyPdf :: Double -> Double -> Double cauchyP :: Double -> Double -> Double cauchyQ :: Double -> Double -> Double cauchyPInv :: Double -> Double -> Double cauchyQInv :: Double -> Double -> Double -- | Random number generators. module GSL.Random.Gen newtype RNG MkRNG :: (ForeignPtr ()) -> RNG data RNGType -- | Allocate a new random number generator of the given type and -- initialize it with the default seed. newRNG :: RNGType -> IO RNG -- | Seed the generator with the given value. setSeed :: RNG -> Word64 -> IO () -- | Returns a value uniform in [rngMin, rngMax] getSample :: RNG -> IO Word64 -- | Returns a value uniform on [0,1) getUniform :: RNG -> IO Double -- | Returns a value uniform on (0,1) getUniformPos :: RNG -> IO Double -- | Returns an integer uniform on [0,n-1]. n must be greater than -- 0. getUniformInt :: RNG -> Int -> IO Int -- | Get the name of the generator. getName :: RNG -> IO String -- | Get the largest value that the generator can return. getMax :: RNG -> IO Word64 -- | Get the smallest value that the generator can return. getMin :: RNG -> IO Word64 -- | Get the size of the generator state, in bytes. getSize :: RNG -> IO Word64 -- | Get the generator state. getState :: RNG -> IO [Word8] -- | Set the generator state. The input array should have size equal to -- getSize of the generator; otherwise, strange things will -- happen. setState :: RNG -> [Word8] -> IO () -- | copyRNG dst src copies the state from one generator to -- another. The two generators must have the same type. copyRNG :: RNG -> RNG -> IO () -- | Allocate a new random number generator that is an exact copy of -- another generator cloneRNG :: RNG -> IO RNG mt19937 :: RNGType rngType :: String -> Maybe RNGType