commit d38dbddfabddbdbe8d915fde445c45e4f409ef8f
parent e56d43e42e56fd580cb98c932957e2cd90dec51c
Author: Jared Tobin <jared@jtobin.ca>
Date: Sun, 3 Apr 2016 11:01:05 +0700
Fix segfault.
Diffstat:
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/lib/Numeric/MCMC/Flat.hs b/lib/Numeric/MCMC/Flat.hs
@@ -70,7 +70,7 @@ execute
execute target e0 e1 n = do
zs <- replicateM n symmetric
zcs <- replicateM n uniform
- vjs <- replicateM n uniform
+ vjs <- replicateM n (uniformR (1, n))
let js = U.fromList vjs
w0 k = e0 `V.unsafeIndex` pred k
diff --git a/test/Rosenbrock.hs b/test/Rosenbrock.hs
@@ -20,4 +20,5 @@ main = withSystemRandom . asGenIO $ mcmc 10 ensemble rosenbrock where
]
-- ensemble = V.fromList [ V.fromList [negate 1.0 :: Double, negate 1.0], V.fromList [negate 1.0, 1.0], V.fromList [1.0, negate 1.0], V.fromList [1.0, 1.0]]
-
+--
+-- rosenbrock xs = negate (5 *(x1 - x0 ^ 2) ^ 2 + 0.05 * (1 - x0) ^ 2) where [x0, x1] = V.toList xs