commit 64e98a5fb49e9fe3226ea4c01faabd8906d1532d
parent e73f17495e86351deeae1229caf4ef5cf5e55a30
Author: Jared Tobin <jared@jtobin.ca>
Date: Fri, 28 Oct 2016 14:14:41 +1300
[ci skip] Update README.
Diffstat:
3 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/README.md b/README.md
@@ -28,18 +28,19 @@ as a 'flat' transition operator that can be used more generally.
``` haskell
import Numeric.MCMC.Flat
-import Data.Vector (Vector, toList, fromList)
+import qualified Data.Vector.Unboxed as U (Vector, toList, fromList)
+import qualified Data.Vector as V (fromList)
-rosenbrock :: Vector Double -> Double
+rosenbrock :: Particle -> Double
rosenbrock xs = negate (5 *(x1 - x0 ^ 2) ^ 2 + 0.05 * (1 - x0) ^ 2) where
- [x0, x1] = toList xs
+ [x0, x1] = U.toList xs
ensemble :: Ensemble
-ensemble = fromList [
- fromList [negate 1.0, negate 1.0]
- , fromList [negate 1.0, 1.0]
- , fromList [1.0, negate 1.0]
- , fromList [1.0, 1.0]
+ensemble = V.fromList [
+ U.fromList [negate 1.0, negate 1.0]
+ , U.fromList [negate 1.0, 1.0]
+ , U.fromList [1.0, negate 1.0]
+ , U.fromList [1.0, 1.0]
]
main :: IO ()
diff --git a/test/BNN.hs b/test/BNN.hs
@@ -6,7 +6,7 @@ import Numeric.MCMC.Flat
import qualified Data.Vector.Unboxed as U (Vector, toList, fromList)
import qualified Data.Vector as V (fromList)
-bnn :: U.Vector Double -> Double
+bnn :: Particle -> Double
bnn xs = -0.5 * (x0 ^ 2 * x1 ^ 2 + x0 ^ 2 + x1 ^ 2 - 8 * x0 - 8 * x1) where
[x0, x1] = U.toList xs
diff --git a/test/Rosenbrock.hs b/test/Rosenbrock.hs
@@ -6,7 +6,7 @@ import Numeric.MCMC.Flat
import qualified Data.Vector.Unboxed as U (Vector, toList, fromList)
import qualified Data.Vector as V (fromList)
-rosenbrock :: U.Vector Double -> Double
+rosenbrock :: Particle -> Double
rosenbrock xs = negate (5 *(x1 - x0 ^ 2) ^ 2 + 0.05 * (1 - x0) ^ 2) where
[x0, x1] = U.toList xs