flat-mcmc

Painless, efficient, general-purpose sampling from continuous distributions.
Log | Files | Refs | README | LICENSE

commit 3497d940f55edd5e6e745dd96559b0b440b9a82e
parent c855977a4359164b265d548f3d3afec0ea5b1258
Author: Jared Tobin <jared@jtobin.ca>
Date:   Wed,  7 Nov 2012 14:15:54 +1300

Nanosecond-shaving optimization to SPDE example.

Diffstat:
M.gitignore | 1+
MExamples/code/SPDE_Flat.hs | 4++--
2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -12,3 +12,4 @@ _site/ build cabal-dev site +benchmarks diff --git a/Examples/code/SPDE_Flat.hs b/Examples/code/SPDE_Flat.hs @@ -10,8 +10,8 @@ import qualified Data.Vector as V target :: [Double] -> Double target xs = go 0 0 xs - where go !t0 !t1 [] = (-t0 / (2*h)) - (0.5*h*t1) - go !t0 !t1 (u:us:uss) = go (t0 + (us - u)^2) (t1 + v (us + u)) uss + where go t0 t1 [] = (-t0 / (2*h)) - (0.5*h*t1) + go t0 t1 (u:us:uss) = go (t0 + (us - u)^2) (t1 + v (us + u)) uss h = 1 / fromIntegral (length xs) v x = (1 - x^2)^2 {-# INLINE target #-}