Marmote Core
The project aims at realizing the prototype of a software environment dedicated to modeling with Markov chains.
bernoulliDistribution.h
1 #ifndef bernoulliDistribution_H
2 #define bernoulliDistribution_H
3 
4 #include "discreteDistribution.h"
5 
10 class bernoulliDistribution : public virtual discreteDistribution {
11 
12 public:
20  bernoulliDistribution( double ); // creation from a value
21 
22 private:
23  // private variables specific to the distribution
24  double _proba;
26 public:
27  // accessors to specific variables
34  double getParameter() { return _proba; }
41  double proba() { return _proba; }
42 
43 public:
44  // probabilistic member functions
48  double mean();
52  double rate();
56  double moment( int order );
60  double laplace( double s ); // Laplace transform at real points
64  double dLaplace( double s ); // derivative of the Laplace transform
68  double cdf( double x );
72  bool hasMoment( int order );
73 
81  bernoulliDistribution *rescale( double factor );
86 
90  double sample();
91 
92  public:
96  std::string toString();
100  void write( FILE *out, int mode );
101 
102 };
103 
104 #endif // bernoulliDistribution_H
std::string toString()
an utility to convert the distribution into a string.
Definition: bernoulliDistribution.cpp:168
bool hasMoment(int order)
test for the existence of moments of any order
Definition: bernoulliDistribution.cpp:92
double proba()
Accessor to the parameter of the distribution. Redundant with the accessor getParameter() but conform...
Definition: bernoulliDistribution.h:41
double laplace(double s)
computing the Laplace transform of the distribution at real point
Definition: bernoulliDistribution.cpp:103
double sample()
drawing a (pseudo)random value according to the distribution.
Definition: bernoulliDistribution.cpp:203
bernoulliDistribution * copy()
copying a distribution. Typically implemented as rescale(1.0).
Definition: bernoulliDistribution.cpp:195
void write(FILE *out, int mode)
an utility to write the distribution to some file, according to some format.
Definition: bernoulliDistribution.cpp:155
double mean()
computing the mathematical expectation or mean
Definition: bernoulliDistribution.cpp:46
double getParameter()
Accessor to the parameter of the distribution. Redundant with the standard accessor proba() but more ...
Definition: bernoulliDistribution.h:34
double dLaplace(double s)
computing the derivative of the Laplace transform at real points
Definition: bernoulliDistribution.cpp:117
The Bernoulli distribution with two values.
Definition: bernoulliDistribution.h:25
bernoulliDistribution * rescale(double factor)
Rescaling the distribution. Bernoulli distributions cannot be rescaled. Ac copy is returned and an er...
Definition: bernoulliDistribution.cpp:180
double cdf(double x)
computing the cumulative distribution function at some real point x. This is the probability that the...
Definition: bernoulliDistribution.cpp:131
double moment(int order)
Computing the moments of the distribution.
Definition: bernoulliDistribution.cpp:78
The general discrete distribution with finite support.
Definition: discreteDistribution.h:25
bernoulliDistribution(double)
Unique onstructor for a Bernoulli distribution from the probability that it is equal to 1...
Definition: bernoulliDistribution.cpp:21
double rate()
computing the "rate", defined as the inverse of the mean
Definition: bernoulliDistribution.cpp:57