module Numeric.Probability.Trace where
import qualified Numeric.Probability.Distribution as Dist
import qualified Numeric.Probability.Transition as Trans
import qualified Numeric.Probability.Random as Rnd
import Data.List (transpose)
type Trace a = [a]
type Walk a = a -> Trace a
type Space prob a = Trace (Dist.T prob a)
type Expand prob a = a -> Space prob a
walk :: Int -> Trans.Change a -> Walk a
walk n f = take n . iterate f
type RTrace a = Rnd.T (Trace a)
type RWalk a = a -> RTrace a
type RSpace prob a = Rnd.T (Space prob a)
type RExpand prob a = a -> RSpace prob a
merge :: (Fractional prob, Ord a) =>
[RTrace a] -> RSpace prob a
merge =
fmap (zipListWith (Dist.norm . Dist.uniform)) . sequence
zipListWith :: ([a] -> b) -> [[a]] -> [b]
zipListWith f = map f . transpose