Marmote Core
The project aims at realizing the prototype of a software environment dedicated to modeling with Markov chains.
|
Aliasing data. More...
#include <alias.h>
Public Member Functions | |
int | size () const |
Give the size of aliasing array. More... | |
double | threshold (const int i) const |
Give the threshold corresponding to the ith aliasing array index. More... | |
int | col (const int i) const |
Give the column index corresponding to the ith aliasing array index. More... | |
int | alias (const int i) const |
Give the alias index corresponding to the ith aliasing array index. More... | |
void | init (const int d) |
Initialization of aliasing tables. More... | |
void | mk_walker (const int d) |
Construction of Walker array. More... | |
void | transpose (const int d) |
Transposition of Walker array. More... | |
int | read (const string path) |
Reading of aliasing data for simulation step. More... | |
void | write_construct (const string file_name, const int d) |
Writing of definitive Walker array (stored by column). More... | |
int | walk (const double rand, const int j, const int n, const int d, const int i) |
Walker's algorithm for discrete distributions. More... | |
Aliasing data.
Walker's algorithm is used to generate internal transitions in the simulation kernel.
|
inline |
Give the alias index corresponding to the ith aliasing array index.
|
inline |
Give the column index corresponding to the ith aliasing array index.
void Alias::init | ( | const int | d | ) |
Initialization of aliasing tables.
d | an integer corresponding to the matrix width. |
void Alias::mk_walker | ( | const int | d | ) |
Construction of Walker array.
This array is built by rows and provides a representetion of the Markov chain to simulate.
d | an integer corresponding to the matrix width. |
int Alias::read | ( | const string | file | ) |
Reading of aliasing data for simulation step.
file | a string corresponding to the name of the input file '.simu'. |
|
inline |
Give the size of aliasing array.
|
inline |
Give the threshold corresponding to the ith aliasing array index.
void Alias::transpose | ( | const int | d | ) |
Transposition of Walker array.
d | an integer corresponding to the matrix width. We obtain by this way a contiguous representation for the simulation step. |
int Alias::walk | ( | const double | rand, |
const int | j, | ||
const int | n, | ||
const int | d, | ||
const int | i | ||
) |
Walker's algorithm for discrete distributions.
rand | a double value according to uniform law on [0;1]. |
j | an integer corresponding to a random choice of column index. |
n | an integer corresponding to the space state dimension. |
d | an integer corresponding to the matrix width. |
i | an integer between 0 and N-1 ( where N:= matrix dimension) being the current cursor. |
void Alias::write_construct | ( | const string | file_name, |
const int | d | ||
) |
Writing of definitive Walker array (stored by column).
namefile | a string corresponding to the name of the output file '.simu'. |
d | an integer corresponding to the matrix width. |