Stability | experimental |
---|---|
Maintainer | Patrick Perry <patperry@stanford.edu> |
Safe Haskell | None |
Quasi-random number generators.
- newtype QRNG = MkQRNG (ForeignPtr QRNG)
- data QRNGType
- newQRNG :: QRNGType -> Int -> IO QRNG
- resetQRNG :: QRNG -> IO ()
- getSample :: QRNG -> Ptr Double -> IO ()
- getListSample :: QRNG -> IO [Double]
- getName :: QRNG -> IO String
- getDimension :: QRNG -> IO Int
- getSize :: QRNG -> IO Word64
- getState :: QRNG -> IO [Word8]
- setState :: QRNG -> [Word8] -> IO ()
- copyQRNG :: QRNG -> QRNG -> IO ()
- cloneQRNG :: QRNG -> IO QRNG
- niederreiter :: QRNGType
- sobol :: QRNGType
- halton :: QRNGType
- reverseHalton :: QRNGType
- maxDimension :: QRNGType -> Int
Data types
Initializing
newQRNG :: QRNGType -> Int -> IO QRNGSource
Allocate a new quasi-random number generator of the given type, generating points with the given number of dimensions.
Sampling
getSample :: QRNG -> Ptr Double -> IO ()Source
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).
getListSample :: QRNG -> IO [Double]Source
Gets the next sample point as a list.
Auxiliary functions
getDimension :: QRNG -> IO IntSource
The dimension of the sequence.
setState :: QRNG -> [Word8] -> IO ()Source
Set the generator state. The input array should have size equal to
getSize
of the generator; otherwise, strange things will happen.
Copying state
copyQRNG :: QRNG -> QRNG -> IO ()Source
copyQRNG dst src
copies the state from one generator to another. The
two generators must have the same type.
cloneQRNG :: QRNG -> IO QRNGSource
Allocate a new quasi-random number generator that is exact copy of another generator.
Algorithms
maxDimension :: QRNGType -> IntSource
The maximum dimension of samples that the given generator supports.