Marmote Core
The project aims at realizing the prototype of a software environment dedicated to modeling with Markov chains.
geometricDistribution.h
1 #ifndef geometricDistribution_H
2 #define geometricDistribution_
3 
4 #include "Distribution.h"
5 
12 class geometricDistribution : public virtual Distribution {
13 
14 public:
15  // constructors
21  geometricDistribution( double p );
22 
23 private:
24  // specific variables
25  double _p;
27 public:
28  // accessors
35  double getProba( int k );
42  double p() { return _p; }
49  double getRatio() { return _p; }
50 
51 public:
52  // probabilistic member functions
58  double mean();
64  double rate(); // inverse of the mean
68  double moment( int order );
72  double laplace( double s ); // Laplace transform at real points
76  double dLaplace( double s ); // derivative of the Laplace transform
83  double cdf( double x );
90  bool hasMoment( int order );
91 
98  geometricDistribution *rescale( double factor );
103 
111  double sample();
112 
113  public:
119  std::string toString();
126  void write( FILE *out, int mode );
127 
128 };
129 
130 #endif // geometricDistribution_H
double sample()
Sampling from the distribution. The method uses the fact that the integer part of an exponential rand...
Definition: geometricDistribution.cpp:260
double laplace(double s)
computing the Laplace transform of the distribution at real point
Definition: geometricDistribution.cpp:142
double dLaplace(double s)
computing the derivative of the Laplace transform at real points
Definition: geometricDistribution.cpp:158
double getProba(int k)
Function to obtain the probability of a specific value k.
Definition: geometricDistribution.cpp:194
double cdf(double x)
Definition: geometricDistribution.cpp:177
geometricDistribution * rescale(double factor)
Rescaling the distribution. Geometric distributions cannot be rescaled. A copy is returned...
Definition: geometricDistribution.cpp:237
A class for representing probability distributions.
Definition: Distribution.h:44
geometricDistribution(double p)
Unique constructor for the class, from its "ratio".
Definition: geometricDistribution.cpp:29
std::string toString()
Definition: geometricDistribution.cpp:224
The geometric distribution with starting value 0. The parameter "p" is called "ratio".
Definition: geometricDistribution.h:27
double rate()
Definition: geometricDistribution.cpp:68
double p()
Function to obtain the parameter (or ratio) of the distribution. Redundant with p() but defined to be...
Definition: geometricDistribution.h:57
double moment(int order)
Computing the moments of the distribution.
Definition: geometricDistribution.cpp:89
double getRatio()
Function to obtain the parameter (or ratio) of the distribution. Redundant with getRatio() but define...
Definition: geometricDistribution.h:49
double mean()
Function to obtain the mean (expectation). Its value is 1/(1-_p)
Definition: geometricDistribution.cpp:57
bool hasMoment(int order)
Test of existence of a moment. These distributions always have one.
Definition: geometricDistribution.cpp:131
geometricDistribution * copy()
copying a distribution. Typically implemented as rescale(1.0).
Definition: geometricDistribution.cpp:252
void write(FILE *out, int mode)
Definition: geometricDistribution.cpp:205