Marmote Core
The project aims at realizing the prototype of a software environment dedicated to modeling with Markov chains.
templateDistribution.h
1 #ifndef templateDistribution_H
2 #define templateDistribution_H
3 
4 #include "Distribution.h"
5 
10 class templateDistribution : public virtual Distribution {
11 
12 public:
22  templateDistribution( int x, double* y, double* z ); // creation from something
23 
24 private:
25  // private variables specific to the distribution
26  int _nbVals;
27  double* _values;
28  double* _probas;
30 public:
31  // accessors to specific variables
32 
33 public:
34  // probabilistic member functions
38  double mean();
42  double rate();
46  double moment( int order );
50  double variance();
54  double laplace( double s ); // Laplace transform at real points
58  double dLaplace( double s ); // derivative of the Laplace transform
62  double cdf( double x );
66  double ccdf( double x );
70  bool hasMoment( int order );
71 
75  templateDistribution *rescale( double factor );
83  double sample();
87  void iidSample( int n, double* s );
88 
89  public:
93  std::string toString();
97  void write( FILE *out, int mode );
98 
99 };
100 
101 #endif // templateDistribution_H
templateDistribution * copy()
copying a distribution. Typically implemented as rescale(1.0).
Definition: templateDistribution.cpp:174
double rate()
computing the "rate", defined as the inverse of the mean
Definition: templateDistribution.cpp:46
void write(FILE *out, int mode)
an utility to write the distribution to some file, according to some format.
Definition: templateDistribution.cpp:124
bool hasMoment(int order)
test for the existence of moments of any order
Definition: templateDistribution.cpp:71
double sample()
drawing a (pseudo)random value according to the distribution.
Definition: templateDistribution.cpp:187
double mean()
computing the mathematical expectation or mean
Definition: templateDistribution.cpp:35
double moment(int order)
Computing the moments of the distribution.
Definition: templateDistribution.cpp:62
A class for representing probability distributions.
Definition: Distribution.h:44
void iidSample(int n, double *s)
drawing an i.i.d. sample from the distribution. The result is returned in an array (that must have be...
Definition: templateDistribution.cpp:203
double ccdf(double x)
computing the complementary cumulative distributon function (or tail) at some real point x...
templateDistribution(int x, double *y, double *z)
Constructor for a "xxx" distribution from things and other. The mean is calculated at creation (or no...
The general template distribution to be instantiated.
Definition: templateDistribution.h:25
double laplace(double s)
computing the Laplace transform of the distribution at real point
Definition: templateDistribution.cpp:82
double dLaplace(double s)
computing the derivative of the Laplace transform at real points
Definition: templateDistribution.cpp:96
std::string toString()
an utility to convert the distribution into a string.
Definition: templateDistribution.cpp:143
double cdf(double x)
computing the cumulative distribution function at some real point x. This is the probability that the...
Definition: templateDistribution.cpp:110
double variance()
Computing the variance of the random variable: the second moment minus the square of the first moment...
templateDistribution * rescale(double factor)
rescaling a distribution by some real factor. Not all distributions allow this for any real factor...
Definition: templateDistribution.cpp:160