heptagon/examples/random
Gwenaël Delaval d5ee87b7ed Added example Markov
Example Markov : simulation of a Markov chain.

Use of a Random module, external call to C rand() function.
2015-09-17 11:17:29 +02:00
..
README Added example Markov 2015-09-17 11:17:29 +02:00
markov.ept Added example Markov 2015-09-17 11:17:29 +02:00
mathext.c Added example Markov 2015-09-17 11:17:29 +02:00
mathext.epi Added example Markov 2015-09-17 11:17:29 +02:00
mathext.h Added example Markov 2015-09-17 11:17:29 +02:00
random.c Added example Markov 2015-09-17 11:17:29 +02:00
random.epi Added example Markov 2015-09-17 11:17:29 +02:00
random.h Added example Markov 2015-09-17 11:17:29 +02:00

README

Simple Markov chain simulation by external call to random() C function :

- random.epi : Heptagon interface containing the declaration of
  random() function

- random.h, random.c : "glue" between actual random() C function and
  function calls generated by Heptagon

- markov.ept : contains node "process", simulating a two-state Markov
  chain, with probability p (constant) at each step to go from one
  state to the other

Function "random" and node "process" are declared unsafe to avoid
optimization removing calls to "random" ("random" has side effects).

Compilation and simulation :

heptc random.epi
heptc -target c -s process -hepts markov.ept
gcc -I . -I markov_c -I /usr/local/lib/heptagon/c random.c markov_c/_main.c markov_c/markov.c markov_c/markov_types.c -o markov
hepts -mod Markov -node process -exec ./markov