module Simulation.Aivika.Trans.Process.Random
(randomUniformProcess,
randomUniformProcess_,
randomUniformIntProcess,
randomUniformIntProcess_,
randomTriangularProcess,
randomTriangularProcess_,
randomNormalProcess,
randomNormalProcess_,
randomLogNormalProcess,
randomLogNormalProcess_,
randomExponentialProcess,
randomExponentialProcess_,
randomErlangProcess,
randomErlangProcess_,
randomPoissonProcess,
randomPoissonProcess_,
randomBinomialProcess,
randomBinomialProcess_,
randomGammaProcess,
randomGammaProcess_,
randomBetaProcess,
randomBetaProcess_,
randomWeibullProcess,
randomWeibullProcess_,
randomDiscreteProcess,
randomDiscreteProcess_) where
import Control.Monad
import Control.Monad.Trans
import Simulation.Aivika.Trans.DES
import Simulation.Aivika.Trans.Generator
import Simulation.Aivika.Trans.Parameter
import Simulation.Aivika.Trans.Parameter.Random
import Simulation.Aivika.Trans.Process
randomUniformProcess :: MonadDES m
=> Double
-> Double
-> Process m Double
{-# INLINABLE randomUniformProcess #-}
randomUniformProcess :: Double -> Double -> Process m Double
randomUniformProcess Double
min Double
max =
do Double
t <- Parameter m Double -> Process m Double
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
ParameterLift t m =>
Parameter m a -> t m a
liftParameter (Parameter m Double -> Process m Double)
-> Parameter m Double -> Process m Double
forall a b. (a -> b) -> a -> b
$ Double -> Double -> Parameter m Double
forall (m :: * -> *).
MonadComp m =>
Double -> Double -> Parameter m Double
randomUniform Double
min Double
max
Double -> Process m ()
forall (m :: * -> *). MonadDES m => Double -> Process m ()
holdProcess Double
t
Double -> Process m Double
forall (m :: * -> *) a. Monad m => a -> m a
return Double
t
randomUniformProcess_ :: MonadDES m
=> Double
-> Double
-> Process m ()
{-# INLINABLE randomUniformProcess_ #-}
randomUniformProcess_ :: Double -> Double -> Process m ()
randomUniformProcess_ Double
min Double
max =
do Double
t <- Parameter m Double -> Process m Double
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
ParameterLift t m =>
Parameter m a -> t m a
liftParameter (Parameter m Double -> Process m Double)
-> Parameter m Double -> Process m Double
forall a b. (a -> b) -> a -> b
$ Double -> Double -> Parameter m Double
forall (m :: * -> *).
MonadComp m =>
Double -> Double -> Parameter m Double
randomUniform Double
min Double
max
Double -> Process m ()
forall (m :: * -> *). MonadDES m => Double -> Process m ()
holdProcess Double
t
randomUniformIntProcess :: MonadDES m
=> Int
-> Int
-> Process m Int
{-# INLINABLE randomUniformIntProcess #-}
randomUniformIntProcess :: Int -> Int -> Process m Int
randomUniformIntProcess Int
min Int
max =
do Int
t <- Parameter m Int -> Process m Int
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
ParameterLift t m =>
Parameter m a -> t m a
liftParameter (Parameter m Int -> Process m Int)
-> Parameter m Int -> Process m Int
forall a b. (a -> b) -> a -> b
$ Int -> Int -> Parameter m Int
forall (m :: * -> *). MonadComp m => Int -> Int -> Parameter m Int
randomUniformInt Int
min Int
max
Double -> Process m ()
forall (m :: * -> *). MonadDES m => Double -> Process m ()
holdProcess (Double -> Process m ()) -> Double -> Process m ()
forall a b. (a -> b) -> a -> b
$ Int -> Double
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
t
Int -> Process m Int
forall (m :: * -> *) a. Monad m => a -> m a
return Int
t
randomUniformIntProcess_ :: MonadDES m
=> Int
-> Int
-> Process m ()
{-# INLINABLE randomUniformIntProcess_ #-}
randomUniformIntProcess_ :: Int -> Int -> Process m ()
randomUniformIntProcess_ Int
min Int
max =
do Int
t <- Parameter m Int -> Process m Int
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
ParameterLift t m =>
Parameter m a -> t m a
liftParameter (Parameter m Int -> Process m Int)
-> Parameter m Int -> Process m Int
forall a b. (a -> b) -> a -> b
$ Int -> Int -> Parameter m Int
forall (m :: * -> *). MonadComp m => Int -> Int -> Parameter m Int
randomUniformInt Int
min Int
max
Double -> Process m ()
forall (m :: * -> *). MonadDES m => Double -> Process m ()
holdProcess (Double -> Process m ()) -> Double -> Process m ()
forall a b. (a -> b) -> a -> b
$ Int -> Double
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
t
randomTriangularProcess :: MonadDES m
=> Double
-> Double
-> Double
-> Process m Double
{-# INLINABLE randomTriangularProcess #-}
randomTriangularProcess :: Double -> Double -> Double -> Process m Double
randomTriangularProcess Double
min Double
median Double
max =
do Double
t <- Parameter m Double -> Process m Double
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
ParameterLift t m =>
Parameter m a -> t m a
liftParameter (Parameter m Double -> Process m Double)
-> Parameter m Double -> Process m Double
forall a b. (a -> b) -> a -> b
$ Double -> Double -> Double -> Parameter m Double
forall (m :: * -> *).
MonadComp m =>
Double -> Double -> Double -> Parameter m Double
randomTriangular Double
min Double
median Double
max
Double -> Process m ()
forall (m :: * -> *). MonadDES m => Double -> Process m ()
holdProcess Double
t
Double -> Process m Double
forall (m :: * -> *) a. Monad m => a -> m a
return Double
t
randomTriangularProcess_ :: MonadDES m
=> Double
-> Double
-> Double
-> Process m ()
{-# INLINABLE randomTriangularProcess_ #-}
randomTriangularProcess_ :: Double -> Double -> Double -> Process m ()
randomTriangularProcess_ Double
min Double
median Double
max =
do Double
t <- Parameter m Double -> Process m Double
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
ParameterLift t m =>
Parameter m a -> t m a
liftParameter (Parameter m Double -> Process m Double)
-> Parameter m Double -> Process m Double
forall a b. (a -> b) -> a -> b
$ Double -> Double -> Double -> Parameter m Double
forall (m :: * -> *).
MonadComp m =>
Double -> Double -> Double -> Parameter m Double
randomTriangular Double
min Double
median Double
max
Double -> Process m ()
forall (m :: * -> *). MonadDES m => Double -> Process m ()
holdProcess Double
t
randomNormalProcess :: MonadDES m
=> Double
-> Double
-> Process m Double
{-# INLINABLE randomNormalProcess #-}
randomNormalProcess :: Double -> Double -> Process m Double
randomNormalProcess Double
mu Double
nu =
do Double
t <- Parameter m Double -> Process m Double
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
ParameterLift t m =>
Parameter m a -> t m a
liftParameter (Parameter m Double -> Process m Double)
-> Parameter m Double -> Process m Double
forall a b. (a -> b) -> a -> b
$ Double -> Double -> Parameter m Double
forall (m :: * -> *).
MonadComp m =>
Double -> Double -> Parameter m Double
randomNormal Double
mu Double
nu
Bool -> Process m () -> Process m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (Double
t Double -> Double -> Bool
forall a. Ord a => a -> a -> Bool
> Double
0) (Process m () -> Process m ()) -> Process m () -> Process m ()
forall a b. (a -> b) -> a -> b
$
Double -> Process m ()
forall (m :: * -> *). MonadDES m => Double -> Process m ()
holdProcess Double
t
Double -> Process m Double
forall (m :: * -> *) a. Monad m => a -> m a
return Double
t
randomNormalProcess_ :: MonadDES m
=> Double
-> Double
-> Process m ()
{-# INLINABLE randomNormalProcess_ #-}
randomNormalProcess_ :: Double -> Double -> Process m ()
randomNormalProcess_ Double
mu Double
nu =
do Double
t <- Parameter m Double -> Process m Double
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
ParameterLift t m =>
Parameter m a -> t m a
liftParameter (Parameter m Double -> Process m Double)
-> Parameter m Double -> Process m Double
forall a b. (a -> b) -> a -> b
$ Double -> Double -> Parameter m Double
forall (m :: * -> *).
MonadComp m =>
Double -> Double -> Parameter m Double
randomNormal Double
mu Double
nu
Bool -> Process m () -> Process m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (Double
t Double -> Double -> Bool
forall a. Ord a => a -> a -> Bool
> Double
0) (Process m () -> Process m ()) -> Process m () -> Process m ()
forall a b. (a -> b) -> a -> b
$
Double -> Process m ()
forall (m :: * -> *). MonadDES m => Double -> Process m ()
holdProcess Double
t
randomLogNormalProcess :: MonadDES m
=> Double
-> Double
-> Process m Double
{-# INLINABLE randomLogNormalProcess #-}
randomLogNormalProcess :: Double -> Double -> Process m Double
randomLogNormalProcess Double
mu Double
nu =
do Double
t <- Parameter m Double -> Process m Double
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
ParameterLift t m =>
Parameter m a -> t m a
liftParameter (Parameter m Double -> Process m Double)
-> Parameter m Double -> Process m Double
forall a b. (a -> b) -> a -> b
$ Double -> Double -> Parameter m Double
forall (m :: * -> *).
MonadComp m =>
Double -> Double -> Parameter m Double
randomLogNormal Double
mu Double
nu
Double -> Process m ()
forall (m :: * -> *). MonadDES m => Double -> Process m ()
holdProcess Double
t
Double -> Process m Double
forall (m :: * -> *) a. Monad m => a -> m a
return Double
t
randomLogNormalProcess_ :: MonadDES m
=> Double
-> Double
-> Process m ()
{-# INLINABLE randomLogNormalProcess_ #-}
randomLogNormalProcess_ :: Double -> Double -> Process m ()
randomLogNormalProcess_ Double
mu Double
nu =
do Double
t <- Parameter m Double -> Process m Double
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
ParameterLift t m =>
Parameter m a -> t m a
liftParameter (Parameter m Double -> Process m Double)
-> Parameter m Double -> Process m Double
forall a b. (a -> b) -> a -> b
$ Double -> Double -> Parameter m Double
forall (m :: * -> *).
MonadComp m =>
Double -> Double -> Parameter m Double
randomLogNormal Double
mu Double
nu
Double -> Process m ()
forall (m :: * -> *). MonadDES m => Double -> Process m ()
holdProcess Double
t
randomExponentialProcess :: MonadDES m
=> Double
-> Process m Double
{-# INLINABLE randomExponentialProcess #-}
randomExponentialProcess :: Double -> Process m Double
randomExponentialProcess Double
mu =
do Double
t <- Parameter m Double -> Process m Double
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
ParameterLift t m =>
Parameter m a -> t m a
liftParameter (Parameter m Double -> Process m Double)
-> Parameter m Double -> Process m Double
forall a b. (a -> b) -> a -> b
$ Double -> Parameter m Double
forall (m :: * -> *). MonadComp m => Double -> Parameter m Double
randomExponential Double
mu
Double -> Process m ()
forall (m :: * -> *). MonadDES m => Double -> Process m ()
holdProcess Double
t
Double -> Process m Double
forall (m :: * -> *) a. Monad m => a -> m a
return Double
t
randomExponentialProcess_ :: MonadDES m
=> Double
-> Process m ()
{-# INLINABLE randomExponentialProcess_ #-}
randomExponentialProcess_ :: Double -> Process m ()
randomExponentialProcess_ Double
mu =
do Double
t <- Parameter m Double -> Process m Double
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
ParameterLift t m =>
Parameter m a -> t m a
liftParameter (Parameter m Double -> Process m Double)
-> Parameter m Double -> Process m Double
forall a b. (a -> b) -> a -> b
$ Double -> Parameter m Double
forall (m :: * -> *). MonadComp m => Double -> Parameter m Double
randomExponential Double
mu
Double -> Process m ()
forall (m :: * -> *). MonadDES m => Double -> Process m ()
holdProcess Double
t
randomErlangProcess :: MonadDES m
=> Double
-> Int
-> Process m Double
{-# INLINABLE randomErlangProcess #-}
randomErlangProcess :: Double -> Int -> Process m Double
randomErlangProcess Double
beta Int
m =
do Double
t <- Parameter m Double -> Process m Double
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
ParameterLift t m =>
Parameter m a -> t m a
liftParameter (Parameter m Double -> Process m Double)
-> Parameter m Double -> Process m Double
forall a b. (a -> b) -> a -> b
$ Double -> Int -> Parameter m Double
forall (m :: * -> *).
MonadComp m =>
Double -> Int -> Parameter m Double
randomErlang Double
beta Int
m
Double -> Process m ()
forall (m :: * -> *). MonadDES m => Double -> Process m ()
holdProcess Double
t
Double -> Process m Double
forall (m :: * -> *) a. Monad m => a -> m a
return Double
t
randomErlangProcess_ :: MonadDES m
=> Double
-> Int
-> Process m ()
{-# INLINABLE randomErlangProcess_ #-}
randomErlangProcess_ :: Double -> Int -> Process m ()
randomErlangProcess_ Double
beta Int
m =
do Double
t <- Parameter m Double -> Process m Double
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
ParameterLift t m =>
Parameter m a -> t m a
liftParameter (Parameter m Double -> Process m Double)
-> Parameter m Double -> Process m Double
forall a b. (a -> b) -> a -> b
$ Double -> Int -> Parameter m Double
forall (m :: * -> *).
MonadComp m =>
Double -> Int -> Parameter m Double
randomErlang Double
beta Int
m
Double -> Process m ()
forall (m :: * -> *). MonadDES m => Double -> Process m ()
holdProcess Double
t
randomPoissonProcess :: MonadDES m
=> Double
-> Process m Int
{-# INLINABLE randomPoissonProcess #-}
randomPoissonProcess :: Double -> Process m Int
randomPoissonProcess Double
mu =
do Int
t <- Parameter m Int -> Process m Int
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
ParameterLift t m =>
Parameter m a -> t m a
liftParameter (Parameter m Int -> Process m Int)
-> Parameter m Int -> Process m Int
forall a b. (a -> b) -> a -> b
$ Double -> Parameter m Int
forall (m :: * -> *). MonadComp m => Double -> Parameter m Int
randomPoisson Double
mu
Double -> Process m ()
forall (m :: * -> *). MonadDES m => Double -> Process m ()
holdProcess (Double -> Process m ()) -> Double -> Process m ()
forall a b. (a -> b) -> a -> b
$ Int -> Double
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
t
Int -> Process m Int
forall (m :: * -> *) a. Monad m => a -> m a
return Int
t
randomPoissonProcess_ :: MonadDES m
=> Double
-> Process m ()
{-# INLINABLE randomPoissonProcess_ #-}
randomPoissonProcess_ :: Double -> Process m ()
randomPoissonProcess_ Double
mu =
do Int
t <- Parameter m Int -> Process m Int
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
ParameterLift t m =>
Parameter m a -> t m a
liftParameter (Parameter m Int -> Process m Int)
-> Parameter m Int -> Process m Int
forall a b. (a -> b) -> a -> b
$ Double -> Parameter m Int
forall (m :: * -> *). MonadComp m => Double -> Parameter m Int
randomPoisson Double
mu
Double -> Process m ()
forall (m :: * -> *). MonadDES m => Double -> Process m ()
holdProcess (Double -> Process m ()) -> Double -> Process m ()
forall a b. (a -> b) -> a -> b
$ Int -> Double
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
t
randomBinomialProcess :: MonadDES m
=> Double
-> Int
-> Process m Int
{-# INLINABLE randomBinomialProcess #-}
randomBinomialProcess :: Double -> Int -> Process m Int
randomBinomialProcess Double
prob Int
trials =
do Int
t <- Parameter m Int -> Process m Int
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
ParameterLift t m =>
Parameter m a -> t m a
liftParameter (Parameter m Int -> Process m Int)
-> Parameter m Int -> Process m Int
forall a b. (a -> b) -> a -> b
$ Double -> Int -> Parameter m Int
forall (m :: * -> *).
MonadComp m =>
Double -> Int -> Parameter m Int
randomBinomial Double
prob Int
trials
Double -> Process m ()
forall (m :: * -> *). MonadDES m => Double -> Process m ()
holdProcess (Double -> Process m ()) -> Double -> Process m ()
forall a b. (a -> b) -> a -> b
$ Int -> Double
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
t
Int -> Process m Int
forall (m :: * -> *) a. Monad m => a -> m a
return Int
t
randomBinomialProcess_ :: MonadDES m
=>Double
-> Int
-> Process m ()
{-# INLINABLE randomBinomialProcess_ #-}
randomBinomialProcess_ :: Double -> Int -> Process m ()
randomBinomialProcess_ Double
prob Int
trials =
do Int
t <- Parameter m Int -> Process m Int
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
ParameterLift t m =>
Parameter m a -> t m a
liftParameter (Parameter m Int -> Process m Int)
-> Parameter m Int -> Process m Int
forall a b. (a -> b) -> a -> b
$ Double -> Int -> Parameter m Int
forall (m :: * -> *).
MonadComp m =>
Double -> Int -> Parameter m Int
randomBinomial Double
prob Int
trials
Double -> Process m ()
forall (m :: * -> *). MonadDES m => Double -> Process m ()
holdProcess (Double -> Process m ()) -> Double -> Process m ()
forall a b. (a -> b) -> a -> b
$ Int -> Double
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
t
randomGammaProcess :: MonadDES m
=> Double
-> Double
-> Process m Double
{-# INLINABLE randomGammaProcess #-}
randomGammaProcess :: Double -> Double -> Process m Double
randomGammaProcess Double
kappa Double
theta =
do Double
t <- Parameter m Double -> Process m Double
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
ParameterLift t m =>
Parameter m a -> t m a
liftParameter (Parameter m Double -> Process m Double)
-> Parameter m Double -> Process m Double
forall a b. (a -> b) -> a -> b
$ Double -> Double -> Parameter m Double
forall (m :: * -> *).
MonadComp m =>
Double -> Double -> Parameter m Double
randomGamma Double
kappa Double
theta
Double -> Process m ()
forall (m :: * -> *). MonadDES m => Double -> Process m ()
holdProcess Double
t
Double -> Process m Double
forall (m :: * -> *) a. Monad m => a -> m a
return Double
t
randomGammaProcess_ :: MonadDES m
=> Double
-> Double
-> Process m ()
{-# INLINABLE randomGammaProcess_ #-}
randomGammaProcess_ :: Double -> Double -> Process m ()
randomGammaProcess_ Double
kappa Double
theta =
do Double
t <- Parameter m Double -> Process m Double
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
ParameterLift t m =>
Parameter m a -> t m a
liftParameter (Parameter m Double -> Process m Double)
-> Parameter m Double -> Process m Double
forall a b. (a -> b) -> a -> b
$ Double -> Double -> Parameter m Double
forall (m :: * -> *).
MonadComp m =>
Double -> Double -> Parameter m Double
randomGamma Double
kappa Double
theta
Double -> Process m ()
forall (m :: * -> *). MonadDES m => Double -> Process m ()
holdProcess Double
t
randomBetaProcess :: MonadDES m
=> Double
-> Double
-> Process m Double
{-# INLINABLE randomBetaProcess #-}
randomBetaProcess :: Double -> Double -> Process m Double
randomBetaProcess Double
alpha Double
beta =
do Double
t <- Parameter m Double -> Process m Double
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
ParameterLift t m =>
Parameter m a -> t m a
liftParameter (Parameter m Double -> Process m Double)
-> Parameter m Double -> Process m Double
forall a b. (a -> b) -> a -> b
$ Double -> Double -> Parameter m Double
forall (m :: * -> *).
MonadComp m =>
Double -> Double -> Parameter m Double
randomBeta Double
alpha Double
beta
Double -> Process m ()
forall (m :: * -> *). MonadDES m => Double -> Process m ()
holdProcess Double
t
Double -> Process m Double
forall (m :: * -> *) a. Monad m => a -> m a
return Double
t
randomBetaProcess_ :: MonadDES m
=> Double
-> Double
-> Process m ()
{-# INLINABLE randomBetaProcess_ #-}
randomBetaProcess_ :: Double -> Double -> Process m ()
randomBetaProcess_ Double
alpha Double
beta =
do Double
t <- Parameter m Double -> Process m Double
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
ParameterLift t m =>
Parameter m a -> t m a
liftParameter (Parameter m Double -> Process m Double)
-> Parameter m Double -> Process m Double
forall a b. (a -> b) -> a -> b
$ Double -> Double -> Parameter m Double
forall (m :: * -> *).
MonadComp m =>
Double -> Double -> Parameter m Double
randomBeta Double
alpha Double
beta
Double -> Process m ()
forall (m :: * -> *). MonadDES m => Double -> Process m ()
holdProcess Double
t
randomWeibullProcess :: MonadDES m
=> Double
-> Double
-> Process m Double
{-# INLINABLE randomWeibullProcess #-}
randomWeibullProcess :: Double -> Double -> Process m Double
randomWeibullProcess Double
alpha Double
beta =
do Double
t <- Parameter m Double -> Process m Double
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
ParameterLift t m =>
Parameter m a -> t m a
liftParameter (Parameter m Double -> Process m Double)
-> Parameter m Double -> Process m Double
forall a b. (a -> b) -> a -> b
$ Double -> Double -> Parameter m Double
forall (m :: * -> *).
MonadComp m =>
Double -> Double -> Parameter m Double
randomWeibull Double
alpha Double
beta
Double -> Process m ()
forall (m :: * -> *). MonadDES m => Double -> Process m ()
holdProcess Double
t
Double -> Process m Double
forall (m :: * -> *) a. Monad m => a -> m a
return Double
t
randomWeibullProcess_ :: MonadDES m
=> Double
-> Double
-> Process m ()
{-# INLINABLE randomWeibullProcess_ #-}
randomWeibullProcess_ :: Double -> Double -> Process m ()
randomWeibullProcess_ Double
alpha Double
beta =
do Double
t <- Parameter m Double -> Process m Double
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
ParameterLift t m =>
Parameter m a -> t m a
liftParameter (Parameter m Double -> Process m Double)
-> Parameter m Double -> Process m Double
forall a b. (a -> b) -> a -> b
$ Double -> Double -> Parameter m Double
forall (m :: * -> *).
MonadComp m =>
Double -> Double -> Parameter m Double
randomWeibull Double
alpha Double
beta
Double -> Process m ()
forall (m :: * -> *). MonadDES m => Double -> Process m ()
holdProcess Double
t
randomDiscreteProcess :: MonadDES m
=> DiscretePDF Double
-> Process m Double
{-# INLINABLE randomDiscreteProcess #-}
randomDiscreteProcess :: DiscretePDF Double -> Process m Double
randomDiscreteProcess DiscretePDF Double
dpdf =
do Double
t <- Parameter m Double -> Process m Double
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
ParameterLift t m =>
Parameter m a -> t m a
liftParameter (Parameter m Double -> Process m Double)
-> Parameter m Double -> Process m Double
forall a b. (a -> b) -> a -> b
$ DiscretePDF Double -> Parameter m Double
forall (m :: * -> *) a.
MonadComp m =>
DiscretePDF a -> Parameter m a
randomDiscrete DiscretePDF Double
dpdf
Double -> Process m ()
forall (m :: * -> *). MonadDES m => Double -> Process m ()
holdProcess Double
t
Double -> Process m Double
forall (m :: * -> *) a. Monad m => a -> m a
return Double
t
randomDiscreteProcess_ :: MonadDES m
=> DiscretePDF Double
-> Process m ()
{-# INLINABLE randomDiscreteProcess_ #-}
randomDiscreteProcess_ :: DiscretePDF Double -> Process m ()
randomDiscreteProcess_ DiscretePDF Double
dpdf =
do Double
t <- Parameter m Double -> Process m Double
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
ParameterLift t m =>
Parameter m a -> t m a
liftParameter (Parameter m Double -> Process m Double)
-> Parameter m Double -> Process m Double
forall a b. (a -> b) -> a -> b
$ DiscretePDF Double -> Parameter m Double
forall (m :: * -> *) a.
MonadComp m =>
DiscretePDF a -> Parameter m a
randomDiscrete DiscretePDF Double
dpdf
Double -> Process m ()
forall (m :: * -> *). MonadDES m => Double -> Process m ()
holdProcess Double
t