-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | The Metropolis algorithm.
--   
--   The classic Metropolis algorithm.
--   
--   Wander around parameter space according to a simple spherical Gaussian
--   distribution.
--   
--   Exports a <a>mcmc</a> function that prints a trace to stdout, a
--   <a>chain</a> function for collecting results in-memory, and a
--   <a>metropolis</a> transition operator that can be used more generally.
--   
--   <pre>
--   import Numeric.MCMC.Metropolis
--   
--   rosenbrock :: [Double] -&gt; Double
--   rosenbrock [x0, x1] = negate (5  *(x1 - x0 ^ 2) ^ 2 + 0.05 * (1 - x0) ^ 2)
--   
--   main :: IO ()
--   main = withSystemRandom . asGenIO $ mcmc 10000 1 [0, 0] rosenbrock
--   </pre>
@package mighty-metropolis
@version 1.2.0


-- | This implementation uses spherical Gaussian proposals to implement a
--   reliable and computationally inexpensive sampling routine. It can be
--   used as a baseline from which to benchmark other algorithms for a
--   given problem.
--   
--   The <a>mcmc</a> function streams a trace to stdout to be processed
--   elsewhere, while the <a>metropolis</a> transition can be used for more
--   flexible purposes, such as working with samples in memory.
module Numeric.MCMC.Metropolis

-- | Trace <tt>n</tt> iterations of a Markov chain and stream them to
--   stdout.
--   
--   <pre>
--   &gt;&gt;&gt; let rosenbrock [x0, x1] = negate (5  *(x1 - x0 ^ 2) ^ 2 + 0.05 * (1 - x0) ^ 2)
--   
--   &gt;&gt;&gt; withSystemRandom . asGenIO $ mcmc 3 1 [0, 0] rosenbrock
--   0.5000462419822702,0.5693944056267897
--   0.5000462419822702,0.5693944056267897
--   -0.7525995304580824,1.2240725505283248
--   </pre>
mcmc :: (MonadIO m, PrimMonad m, Traversable f, Show (f Double)) => Int -> Double -> f Double -> (f Double -> Double) -> Gen (PrimState m) -> m ()

-- | Trace <tt>n</tt> iterations of a Markov chain and collect the results
--   in a list.
--   
--   <pre>
--   &gt;&gt;&gt; let rosenbrock [x0, x1] = negate (5  *(x1 - x0 ^ 2) ^ 2 + 0.05 * (1 - x0) ^ 2)
--   
--   &gt;&gt;&gt; results &lt;- withSystemRandom . asGenIO $ chain 3 1 [0, 0] rosenbrock
--   
--   &gt;&gt;&gt; mapM_ print results
--   0.0,0.0
--   1.4754117657794871e-2,0.5033208261760778
--   3.8379699517007895e-3,0.24627131099479127
--   </pre>
chain :: (PrimMonad m, Traversable f) => Int -> Double -> f Double -> (f Double -> Double) -> Gen (PrimState m) -> m [Chain (f Double) b]

-- | A generic Metropolis transition operator.
metropolis :: (Traversable f, PrimMonad m) => Double -> Transition m (Chain (f Double) b)

-- | Create a generator for variates using a fixed seed.
create :: PrimMonad m => m Gen PrimState m

-- | Seed a PRNG with data from the system's fast source of pseudo-random
--   numbers. All the caveats of <a>withSystemRandom</a> apply here as
--   well.
createSystemRandom :: IO GenIO

-- | Seed a PRNG with data from the system's fast source of pseudo-random
--   numbers ("<tt>/dev/urandom</tt>" on Unix-like systems or
--   <tt>RtlGenRandom</tt> on Windows), then run the given action.
--   
--   This is a somewhat expensive function, and is intended to be called
--   only occasionally (e.g. once per thread). You should use the
--   <a>Gen</a> it creates to generate many random numbers.
withSystemRandom :: PrimBase m => (Gen PrimState m -> m a) -> IO a

-- | Constrain the type of an action to run in the <a>IO</a> monad.
asGenIO :: () => (GenIO -> IO a) -> GenIO -> IO a
