module Simulation.Aivika.Trans.Dynamics.Random
(memoRandomUniformDynamics,
memoRandomUniformIntDynamics,
memoRandomTriangularDynamics,
memoRandomNormalDynamics,
memoRandomLogNormalDynamics,
memoRandomExponentialDynamics,
memoRandomErlangDynamics,
memoRandomPoissonDynamics,
memoRandomBinomialDynamics,
memoRandomGammaDynamics,
memoRandomBetaDynamics,
memoRandomWeibullDynamics,
memoRandomDiscreteDynamics) where
import Simulation.Aivika.Trans.Generator
import Simulation.Aivika.Trans.Internal.Specs
import Simulation.Aivika.Trans.Internal.Parameter
import Simulation.Aivika.Trans.Internal.Simulation
import Simulation.Aivika.Trans.Internal.Dynamics
import Simulation.Aivika.Trans.Dynamics.Memo.Unboxed
import Simulation.Aivika.Trans.SD
memoRandomUniformDynamics :: MonadSD m
=> Dynamics m Double
-> Dynamics m Double
-> Simulation m (Dynamics m Double)
{-# INLINABLE memoRandomUniformDynamics #-}
memoRandomUniformDynamics :: forall (m :: * -> *).
MonadSD m =>
Dynamics m Double
-> Dynamics m Double -> Simulation m (Dynamics m Double)
memoRandomUniformDynamics Dynamics m Double
min Dynamics m Double
max =
forall (m :: * -> *) e.
MonadMemo m e =>
Dynamics m e -> Simulation m (Dynamics m e)
memo0Dynamics forall a b. (a -> b) -> a -> b
$
forall (m :: * -> *) a. (Point m -> m a) -> Dynamics m a
Dynamics forall a b. (a -> b) -> a -> b
$ \Point m
p ->
do let g :: Generator m
g = forall (m :: * -> *). Run m -> Generator m
runGenerator forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *). Point m -> Run m
pointRun Point m
p
Double
min' <- forall (m :: * -> *) a. Point m -> Dynamics m a -> m a
invokeDynamics Point m
p Dynamics m Double
min
Double
max' <- forall (m :: * -> *) a. Point m -> Dynamics m a -> m a
invokeDynamics Point m
p Dynamics m Double
max
forall (m :: * -> *).
MonadGenerator m =>
Generator m -> Double -> Double -> m Double
generateUniform Generator m
g Double
min' Double
max'
memoRandomUniformIntDynamics :: MonadSD m
=> Dynamics m Int
-> Dynamics m Int
-> Simulation m (Dynamics m Int)
{-# INLINABLE memoRandomUniformIntDynamics #-}
memoRandomUniformIntDynamics :: forall (m :: * -> *).
MonadSD m =>
Dynamics m Int -> Dynamics m Int -> Simulation m (Dynamics m Int)
memoRandomUniformIntDynamics Dynamics m Int
min Dynamics m Int
max =
forall (m :: * -> *) e.
MonadMemo m e =>
Dynamics m e -> Simulation m (Dynamics m e)
memo0Dynamics forall a b. (a -> b) -> a -> b
$
forall (m :: * -> *) a. (Point m -> m a) -> Dynamics m a
Dynamics forall a b. (a -> b) -> a -> b
$ \Point m
p ->
do let g :: Generator m
g = forall (m :: * -> *). Run m -> Generator m
runGenerator forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *). Point m -> Run m
pointRun Point m
p
Int
min' <- forall (m :: * -> *) a. Point m -> Dynamics m a -> m a
invokeDynamics Point m
p Dynamics m Int
min
Int
max' <- forall (m :: * -> *) a. Point m -> Dynamics m a -> m a
invokeDynamics Point m
p Dynamics m Int
max
forall (m :: * -> *).
MonadGenerator m =>
Generator m -> Int -> Int -> m Int
generateUniformInt Generator m
g Int
min' Int
max'
memoRandomTriangularDynamics :: MonadSD m
=> Dynamics m Double
-> Dynamics m Double
-> Dynamics m Double
-> Simulation m (Dynamics m Double)
{-# INLINABLE memoRandomTriangularDynamics #-}
memoRandomTriangularDynamics :: forall (m :: * -> *).
MonadSD m =>
Dynamics m Double
-> Dynamics m Double
-> Dynamics m Double
-> Simulation m (Dynamics m Double)
memoRandomTriangularDynamics Dynamics m Double
min Dynamics m Double
median Dynamics m Double
max =
forall (m :: * -> *) e.
MonadMemo m e =>
Dynamics m e -> Simulation m (Dynamics m e)
memo0Dynamics forall a b. (a -> b) -> a -> b
$
forall (m :: * -> *) a. (Point m -> m a) -> Dynamics m a
Dynamics forall a b. (a -> b) -> a -> b
$ \Point m
p ->
do let g :: Generator m
g = forall (m :: * -> *). Run m -> Generator m
runGenerator forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *). Point m -> Run m
pointRun Point m
p
Double
min' <- forall (m :: * -> *) a. Point m -> Dynamics m a -> m a
invokeDynamics Point m
p Dynamics m Double
min
Double
median' <- forall (m :: * -> *) a. Point m -> Dynamics m a -> m a
invokeDynamics Point m
p Dynamics m Double
median
Double
max' <- forall (m :: * -> *) a. Point m -> Dynamics m a -> m a
invokeDynamics Point m
p Dynamics m Double
max
forall (m :: * -> *).
MonadGenerator m =>
Generator m -> Double -> Double -> Double -> m Double
generateTriangular Generator m
g Double
min' Double
median' Double
max'
memoRandomNormalDynamics :: MonadSD m
=> Dynamics m Double
-> Dynamics m Double
-> Simulation m (Dynamics m Double)
{-# INLINABLE memoRandomNormalDynamics #-}
memoRandomNormalDynamics :: forall (m :: * -> *).
MonadSD m =>
Dynamics m Double
-> Dynamics m Double -> Simulation m (Dynamics m Double)
memoRandomNormalDynamics Dynamics m Double
mu Dynamics m Double
nu =
forall (m :: * -> *) e.
MonadMemo m e =>
Dynamics m e -> Simulation m (Dynamics m e)
memo0Dynamics forall a b. (a -> b) -> a -> b
$
forall (m :: * -> *) a. (Point m -> m a) -> Dynamics m a
Dynamics forall a b. (a -> b) -> a -> b
$ \Point m
p ->
do let g :: Generator m
g = forall (m :: * -> *). Run m -> Generator m
runGenerator forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *). Point m -> Run m
pointRun Point m
p
Double
mu' <- forall (m :: * -> *) a. Point m -> Dynamics m a -> m a
invokeDynamics Point m
p Dynamics m Double
mu
Double
nu' <- forall (m :: * -> *) a. Point m -> Dynamics m a -> m a
invokeDynamics Point m
p Dynamics m Double
nu
forall (m :: * -> *).
MonadGenerator m =>
Generator m -> Double -> Double -> m Double
generateNormal Generator m
g Double
mu' Double
nu'
memoRandomLogNormalDynamics :: MonadSD m
=> Dynamics m Double
-> Dynamics m Double
-> Simulation m (Dynamics m Double)
{-# INLINABLE memoRandomLogNormalDynamics #-}
memoRandomLogNormalDynamics :: forall (m :: * -> *).
MonadSD m =>
Dynamics m Double
-> Dynamics m Double -> Simulation m (Dynamics m Double)
memoRandomLogNormalDynamics Dynamics m Double
mu Dynamics m Double
nu =
forall (m :: * -> *) e.
MonadMemo m e =>
Dynamics m e -> Simulation m (Dynamics m e)
memo0Dynamics forall a b. (a -> b) -> a -> b
$
forall (m :: * -> *) a. (Point m -> m a) -> Dynamics m a
Dynamics forall a b. (a -> b) -> a -> b
$ \Point m
p ->
do let g :: Generator m
g = forall (m :: * -> *). Run m -> Generator m
runGenerator forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *). Point m -> Run m
pointRun Point m
p
Double
mu' <- forall (m :: * -> *) a. Point m -> Dynamics m a -> m a
invokeDynamics Point m
p Dynamics m Double
mu
Double
nu' <- forall (m :: * -> *) a. Point m -> Dynamics m a -> m a
invokeDynamics Point m
p Dynamics m Double
nu
forall (m :: * -> *).
MonadGenerator m =>
Generator m -> Double -> Double -> m Double
generateLogNormal Generator m
g Double
mu' Double
nu'
memoRandomExponentialDynamics :: MonadSD m
=> Dynamics m Double
-> Simulation m (Dynamics m Double)
{-# INLINABLE memoRandomExponentialDynamics #-}
memoRandomExponentialDynamics :: forall (m :: * -> *).
MonadSD m =>
Dynamics m Double -> Simulation m (Dynamics m Double)
memoRandomExponentialDynamics Dynamics m Double
mu =
forall (m :: * -> *) e.
MonadMemo m e =>
Dynamics m e -> Simulation m (Dynamics m e)
memo0Dynamics forall a b. (a -> b) -> a -> b
$
forall (m :: * -> *) a. (Point m -> m a) -> Dynamics m a
Dynamics forall a b. (a -> b) -> a -> b
$ \Point m
p ->
do let g :: Generator m
g = forall (m :: * -> *). Run m -> Generator m
runGenerator forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *). Point m -> Run m
pointRun Point m
p
Double
mu' <- forall (m :: * -> *) a. Point m -> Dynamics m a -> m a
invokeDynamics Point m
p Dynamics m Double
mu
forall (m :: * -> *).
MonadGenerator m =>
Generator m -> Double -> m Double
generateExponential Generator m
g Double
mu'
memoRandomErlangDynamics :: MonadSD m
=> Dynamics m Double
-> Dynamics m Int
-> Simulation m (Dynamics m Double)
{-# INLINABLE memoRandomErlangDynamics #-}
memoRandomErlangDynamics :: forall (m :: * -> *).
MonadSD m =>
Dynamics m Double
-> Dynamics m Int -> Simulation m (Dynamics m Double)
memoRandomErlangDynamics Dynamics m Double
beta Dynamics m Int
m =
forall (m :: * -> *) e.
MonadMemo m e =>
Dynamics m e -> Simulation m (Dynamics m e)
memo0Dynamics forall a b. (a -> b) -> a -> b
$
forall (m :: * -> *) a. (Point m -> m a) -> Dynamics m a
Dynamics forall a b. (a -> b) -> a -> b
$ \Point m
p ->
do let g :: Generator m
g = forall (m :: * -> *). Run m -> Generator m
runGenerator forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *). Point m -> Run m
pointRun Point m
p
Double
beta' <- forall (m :: * -> *) a. Point m -> Dynamics m a -> m a
invokeDynamics Point m
p Dynamics m Double
beta
Int
m' <- forall (m :: * -> *) a. Point m -> Dynamics m a -> m a
invokeDynamics Point m
p Dynamics m Int
m
forall (m :: * -> *).
MonadGenerator m =>
Generator m -> Double -> Int -> m Double
generateErlang Generator m
g Double
beta' Int
m'
memoRandomPoissonDynamics :: MonadSD m
=> Dynamics m Double
-> Simulation m (Dynamics m Int)
{-# INLINABLE memoRandomPoissonDynamics #-}
memoRandomPoissonDynamics :: forall (m :: * -> *).
MonadSD m =>
Dynamics m Double -> Simulation m (Dynamics m Int)
memoRandomPoissonDynamics Dynamics m Double
mu =
forall (m :: * -> *) e.
MonadMemo m e =>
Dynamics m e -> Simulation m (Dynamics m e)
memo0Dynamics forall a b. (a -> b) -> a -> b
$
forall (m :: * -> *) a. (Point m -> m a) -> Dynamics m a
Dynamics forall a b. (a -> b) -> a -> b
$ \Point m
p ->
do let g :: Generator m
g = forall (m :: * -> *). Run m -> Generator m
runGenerator forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *). Point m -> Run m
pointRun Point m
p
Double
mu' <- forall (m :: * -> *) a. Point m -> Dynamics m a -> m a
invokeDynamics Point m
p Dynamics m Double
mu
forall (m :: * -> *).
MonadGenerator m =>
Generator m -> Double -> m Int
generatePoisson Generator m
g Double
mu'
memoRandomBinomialDynamics :: MonadSD m
=> Dynamics m Double
-> Dynamics m Int
-> Simulation m (Dynamics m Int)
{-# INLINABLE memoRandomBinomialDynamics #-}
memoRandomBinomialDynamics :: forall (m :: * -> *).
MonadSD m =>
Dynamics m Double
-> Dynamics m Int -> Simulation m (Dynamics m Int)
memoRandomBinomialDynamics Dynamics m Double
prob Dynamics m Int
trials =
forall (m :: * -> *) e.
MonadMemo m e =>
Dynamics m e -> Simulation m (Dynamics m e)
memo0Dynamics forall a b. (a -> b) -> a -> b
$
forall (m :: * -> *) a. (Point m -> m a) -> Dynamics m a
Dynamics forall a b. (a -> b) -> a -> b
$ \Point m
p ->
do let g :: Generator m
g = forall (m :: * -> *). Run m -> Generator m
runGenerator forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *). Point m -> Run m
pointRun Point m
p
Double
prob' <- forall (m :: * -> *) a. Point m -> Dynamics m a -> m a
invokeDynamics Point m
p Dynamics m Double
prob
Int
trials' <- forall (m :: * -> *) a. Point m -> Dynamics m a -> m a
invokeDynamics Point m
p Dynamics m Int
trials
forall (m :: * -> *).
MonadGenerator m =>
Generator m -> Double -> Int -> m Int
generateBinomial Generator m
g Double
prob' Int
trials'
memoRandomGammaDynamics :: MonadSD m
=> Dynamics m Double
-> Dynamics m Double
-> Simulation m (Dynamics m Double)
{-# INLINABLE memoRandomGammaDynamics #-}
memoRandomGammaDynamics :: forall (m :: * -> *).
MonadSD m =>
Dynamics m Double
-> Dynamics m Double -> Simulation m (Dynamics m Double)
memoRandomGammaDynamics Dynamics m Double
kappa Dynamics m Double
theta =
forall (m :: * -> *) e.
MonadMemo m e =>
Dynamics m e -> Simulation m (Dynamics m e)
memo0Dynamics forall a b. (a -> b) -> a -> b
$
forall (m :: * -> *) a. (Point m -> m a) -> Dynamics m a
Dynamics forall a b. (a -> b) -> a -> b
$ \Point m
p ->
do let g :: Generator m
g = forall (m :: * -> *). Run m -> Generator m
runGenerator forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *). Point m -> Run m
pointRun Point m
p
Double
kappa' <- forall (m :: * -> *) a. Point m -> Dynamics m a -> m a
invokeDynamics Point m
p Dynamics m Double
kappa
Double
theta' <- forall (m :: * -> *) a. Point m -> Dynamics m a -> m a
invokeDynamics Point m
p Dynamics m Double
theta
forall (m :: * -> *).
MonadGenerator m =>
Generator m -> Double -> Double -> m Double
generateGamma Generator m
g Double
kappa' Double
theta'
memoRandomBetaDynamics :: MonadSD m
=> Dynamics m Double
-> Dynamics m Double
-> Simulation m (Dynamics m Double)
{-# INLINABLE memoRandomBetaDynamics #-}
memoRandomBetaDynamics :: forall (m :: * -> *).
MonadSD m =>
Dynamics m Double
-> Dynamics m Double -> Simulation m (Dynamics m Double)
memoRandomBetaDynamics Dynamics m Double
alpha Dynamics m Double
beta =
forall (m :: * -> *) e.
MonadMemo m e =>
Dynamics m e -> Simulation m (Dynamics m e)
memo0Dynamics forall a b. (a -> b) -> a -> b
$
forall (m :: * -> *) a. (Point m -> m a) -> Dynamics m a
Dynamics forall a b. (a -> b) -> a -> b
$ \Point m
p ->
do let g :: Generator m
g = forall (m :: * -> *). Run m -> Generator m
runGenerator forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *). Point m -> Run m
pointRun Point m
p
Double
alpha' <- forall (m :: * -> *) a. Point m -> Dynamics m a -> m a
invokeDynamics Point m
p Dynamics m Double
alpha
Double
beta' <- forall (m :: * -> *) a. Point m -> Dynamics m a -> m a
invokeDynamics Point m
p Dynamics m Double
beta
forall (m :: * -> *).
MonadGenerator m =>
Generator m -> Double -> Double -> m Double
generateBeta Generator m
g Double
alpha' Double
beta'
memoRandomWeibullDynamics :: MonadSD m
=> Dynamics m Double
-> Dynamics m Double
-> Simulation m (Dynamics m Double)
{-# INLINABLE memoRandomWeibullDynamics #-}
memoRandomWeibullDynamics :: forall (m :: * -> *).
MonadSD m =>
Dynamics m Double
-> Dynamics m Double -> Simulation m (Dynamics m Double)
memoRandomWeibullDynamics Dynamics m Double
alpha Dynamics m Double
beta =
forall (m :: * -> *) e.
MonadMemo m e =>
Dynamics m e -> Simulation m (Dynamics m e)
memo0Dynamics forall a b. (a -> b) -> a -> b
$
forall (m :: * -> *) a. (Point m -> m a) -> Dynamics m a
Dynamics forall a b. (a -> b) -> a -> b
$ \Point m
p ->
do let g :: Generator m
g = forall (m :: * -> *). Run m -> Generator m
runGenerator forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *). Point m -> Run m
pointRun Point m
p
Double
alpha' <- forall (m :: * -> *) a. Point m -> Dynamics m a -> m a
invokeDynamics Point m
p Dynamics m Double
alpha
Double
beta' <- forall (m :: * -> *) a. Point m -> Dynamics m a -> m a
invokeDynamics Point m
p Dynamics m Double
beta
forall (m :: * -> *).
MonadGenerator m =>
Generator m -> Double -> Double -> m Double
generateWeibull Generator m
g Double
alpha' Double
beta'
memoRandomDiscreteDynamics :: (MonadSD m, MonadMemo m a) => Dynamics m (DiscretePDF a) -> Simulation m (Dynamics m a)
{-# INLINABLE memoRandomDiscreteDynamics #-}
memoRandomDiscreteDynamics :: forall (m :: * -> *) a.
(MonadSD m, MonadMemo m a) =>
Dynamics m (DiscretePDF a) -> Simulation m (Dynamics m a)
memoRandomDiscreteDynamics Dynamics m (DiscretePDF a)
dpdf =
forall (m :: * -> *) e.
MonadMemo m e =>
Dynamics m e -> Simulation m (Dynamics m e)
memo0Dynamics forall a b. (a -> b) -> a -> b
$
forall (m :: * -> *) a. (Point m -> m a) -> Dynamics m a
Dynamics forall a b. (a -> b) -> a -> b
$ \Point m
p ->
do let g :: Generator m
g = forall (m :: * -> *). Run m -> Generator m
runGenerator forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *). Point m -> Run m
pointRun Point m
p
DiscretePDF a
dpdf' <- forall (m :: * -> *) a. Point m -> Dynamics m a -> m a
invokeDynamics Point m
p Dynamics m (DiscretePDF a)
dpdf
forall (m :: * -> *) a.
MonadGenerator m =>
Generator m -> DiscretePDF a -> m a
generateDiscrete Generator m
g DiscretePDF a
dpdf'