From a20a4351a42904209a5f44033a4409ddc8354de5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20B=C3=A4renz?= Date: Wed, 8 Feb 2023 17:11:57 +0100 Subject: [PATCH] Formatting --- src/Control/Monad/Bayes/Population.hs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Control/Monad/Bayes/Population.hs b/src/Control/Monad/Bayes/Population.hs index 0b41500e..abe52117 100644 --- a/src/Control/Monad/Bayes/Population.hs +++ b/src/Control/Monad/Bayes/Population.hs @@ -41,7 +41,7 @@ where import Control.Applicative (Alternative) import Control.Arrow (second) -import Control.Monad (replicateM, MonadPlus) +import Control.Monad (MonadPlus, replicateM) import Control.Monad.Bayes.Class ( MonadDistribution (categorical, logCategorical, random, uniform), MonadFactor, @@ -185,11 +185,11 @@ stratified weights = do cumulativeSum = V.scanl (+) 0.0 weights coalg (i, j) | i < bigN = - if (positions ! i) < (cumulativeSum ! j) - then Just (Just j, (i + 1, j)) - else Just (Nothing, (i, j + 1)) + if (positions ! i) < (cumulativeSum ! j) + then Just (Just j, (i + 1, j)) + else Just (Nothing, (i, j + 1)) | otherwise = - Nothing + Nothing return $ map (\i -> i - 1) $ catMaybes $ unfoldr coalg (0, 0) -- | Resample the population using the underlying monad and a stratified resampling scheme.