aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Bedo <cu@cua0.org>2025-03-05 12:41:01 +1100
committerJustin Bedo <cu@cua0.org>2025-03-05 12:41:05 +1100
commitc7524e19c481a50a9095b1d567e3d23316915f82 (patch)
treef43deb399fbd32b8dd759f1abdba3f0a75d1bce2
parent3e98e71b49c3e7dbba3af43d18dea106726fef41 (diff)
multisite
-rw-r--r--src/PPL/Sampling.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/PPL/Sampling.hs b/src/PPL/Sampling.hs
index 9a749e9..2d0c380 100644
--- a/src/PPL/Sampling.hs
+++ b/src/PPL/Sampling.hs
@@ -52,11 +52,12 @@ mh g p m = do
mutate :: MonadIO m => StdGen -> IORef (M.HashMap [Int] Double, StdGen) -> m (IORef (M.HashMap [Int] Double, StdGen))
mutate g omega = do
(m, g0) <- liftIO $ readIORef omega
- let (r:q:_) = R.randoms g
+ {-let (r:q:_) = R.randoms g
ks = M.keys m
k = ks !! floor (r * join traceShow (fromIntegral (length ks)))
m' = M.insert k q m
- liftIO $ newIORef $ (m',g0)
+ liftIO $ newIORef $ (m',g0)-}
+ liftIO $ newIORef $ (,g0) $ flip evalState g $ mapM go m
where
go x = do