mighty-metropolis

The classic Metropolis algorithm.
Log | Files | Refs | README | LICENSE

commit c5917a6babfa616df33c1b725af4015320376955
parent 17b5f1b632dd101b4fc8c3d840c1f329f52477ee
Author: Jared Tobin <jared@jtobin.ca>
Date:   Tue,  6 Oct 2015 22:44:20 +1300

Add CPP pragma.

Diffstat:
MNumeric/MCMC/Metropolis.hs | 10++++++----
Mmighty-metropolis.cabal | 6++++--
2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/Numeric/MCMC/Metropolis.hs b/Numeric/MCMC/Metropolis.hs @@ -1,4 +1,5 @@ {-# OPTIONS_GHC -Wall #-} +{-# LANGUAGE CPP #-} {-# LANGUAGE RecordWildCards #-} -- | @@ -10,11 +11,9 @@ -- Stability: unstable -- Portability: ghc -- --- You have to wake up pretty early to beat the Metropolis algorithm. --- -- 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 benchmarks other algorithms on a given problem. +-- as a baseline from which to benchmark other algorithms for a given problem. -- -- The 'mcmc' function streams a trace to stdout to be processed elsewhere, -- while the `metropolis` transition can be used for more flexible purposes, @@ -24,7 +23,7 @@ module Numeric.MCMC.Metropolis ( mcmc , metropolis - -- * re-exported + -- * Re-exported , module Data.Sampling.Types , MWC.create , MWC.createSystemRandom @@ -37,6 +36,9 @@ import Control.Monad.Primitive (PrimMonad, PrimState) import Control.Monad.Trans.Class (lift) import Control.Monad.Trans.State.Strict (execStateT, get, put) import Data.Sampling.Types (Target(..), Chain(..), Transition) +#if __GLASGOW_HASKELL__ < 710 +import Data.Traversable (Traversable, traverse) +#endif import GHC.Prim (RealWorld) import Pipes (Producer, yield, (>->), runEffect) import qualified Pipes.Prelude as Pipes (mapM_, take) diff --git a/mighty-metropolis.cabal b/mighty-metropolis.cabal @@ -10,8 +10,10 @@ category: Numeric build-type: Simple cabal-version: >= 1.10 description: - The classic Metropolis algorithm. Wander around parameter space according to a - simple spherical Gaussian distribution. + The classic Metropolis algorithm. + . + Wander around parameter space according to a simple spherical Gaussian + distribution. . Exports a 'mcmc' function that prints a trace to stdout, as well as a 'metropolis' transition operator that can be used more generally.