ForSyDe-3.0: ForSyDe's Haskell-embedded Domain Specific Language.Source codeContentsIndex
ForSyDe.Shallow.StochasticLib
Portabilityportable
Stabilityexperimental
Maintainerforsyde-dev@ict.kth.se
Contents
Select based synchronous process constructors
Elementary stochastic processes
Description

The stochastic library provides a few stochastic skeletons, which are relatives to the skeletons of the synchronous library. These skeletons are based on two elementary functions, sigmaUn and sigmaGe which provide stochastic signals. The background and motivation for this approach is described in the paper

Axel Jantsch, Ingo Sander, and Wenbiao Wu, "The usage of stochastic processes in embedded system specifications", In Proceedings of the Ninth International Symposium on Hardware and Software Codesign, April 2001 (http://web.it.kth.se/~axel/papers/2001/codes-2001.pdf).

Unfortunately, not all of the suggested skeletons are implemented. In particular, consolidation-based process constructors and all constructors for the untimed and the discrete timed MoCs are missing.

Synopsis
selMapSY :: Int -> a -> b -> a -> b -> Signal a -> Signal b
selScanlSY :: Int -> a -> b -> a -> a -> b -> a -> a -> Signal b -> Signal a
selMealySY :: Int -> Int -> a -> b -> a -> a -> b -> a -> a -> b -> c -> a -> b -> c -> a -> Signal b -> Signal c
selMooreSY :: Int -> Int -> a -> b -> a -> a -> b -> a -> a -> c -> a -> c -> a -> Signal b -> Signal c
sigmaUn :: Int -> (Int, Int) -> Signal Int
sigmaGe :: Float -> Float -> Int -> (Int, Int) -> Signal Int
Select based synchronous process constructors
selMapSYSource
::
=> IntThe seed for the stochastic process
-> a -> bThe first alternative function
-> a -> bThe second alternative function
-> Signal aThe input signal
-> Signal bThe output signal of the process
The skeleton selMapSY is a stochastic variant of mapSY. It has an internal stochastic process and selects one out of two combinatorial functions depending on the output of the stochastic process.
selScanlSYSource
::
=> IntThe seed
-> a -> b -> aThe first alternative next-state function
-> a -> b -> aThe second alternative function
-> aThe initial state
-> Signal bThe input signal
-> Signal aThe output signal
The skeleton selScanlSY is a stochastic variant of scanlSY.
selMealySYSource
::
=> IntThe seed for the next-state function
-> IntThe seed for the output function
-> a -> b -> aFirst alternative for the next-state function
-> a -> b -> aSecond alternative for the next-state function
-> a -> b -> cFirst alternative for the output function
-> a -> b -> cSecond alternative for the output function
-> aThe initial state
-> Signal bThe input signal
-> Signal cThe output signal
selMealySY is the stochastic variant of mealySY. Both the next-state and the output function is randomly selected based on a uniform distribution.
selMooreSYSource
::
=> IntThe seed for the next-state function
-> IntThe seed for the output function
-> a -> b -> aFirst alternative for the next-state function
-> a -> b -> aSecond alternative for the next-state function
-> a -> cFirst alternative for the output function
-> a -> cSecond alternative for the output function
-> aThe initial state
-> Signal bThe input signal
-> Signal cThe output signal
selMooreSY is the stochastic variant of mooreSY. Both the next-state and the output function is randomly selected based on a uniform distribution.
Elementary stochastic processes
sigmaUnSource
:: IntThe seed
-> (Int, Int)The interval from which the stochastic values are taken
-> Signal IntThe sequence of stochastic values
sigmaUn generates a signal list of uniformly distributed Int within the given range and with a given seed.
sigmaGeSource
:: Float -> FloatThe stochastic distribution
-> IntThe seed
-> (Int, Int)The range
-> Signal IntThe sequence of stochastic values

sigmaGe is a more general stochastic process. The first argument is a function f which describes the distribution. For each value v in the given range (r1,r2), f(v) is the probability that v is generated.

Note, that the user has to make sure that sum(f(v))=1 for v in (r1,r2).

For illustration consider the following example.

 pdist :: Float -> Float
 pdist d = 1\/\(2**d\)
 pdistsum 1 = pdist 1
 pdistsum d = \(pdist d\) + \(pdistsum \(d-1\)\)
 pdistnorm :: Float -> Float -> Float
 pdistnorm dmax d = 1\/((pdistsum dmax) * (2**d))

pdistnorm dmax d gives the probability of a value <= d;

pdistnorm dmax dmax is always 1.0

Hence, using pdistnorm as a function in sigmaGe gives an exponantial distribution for values in the range [0, dmax].

Produced by Haddock version 2.1.0