Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Manuel Bärenz committed Feb 8, 2023
1 parent 342fa33 commit a20a435
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Control/Monad/Bayes/Population.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit a20a435

Please sign in to comment.