Marmote Core
The project aims at realizing the prototype of a software environment dedicated to modeling with Markov chains.
diracDistribution.h
1 /* Marmote is free software: you can redistribute it and/or modify
2 it under the terms of the GNU General Public License as published by
3 the Free Software Foundation, either version 3 of the License, or
4 (at your option) any later version.
5 
6 Marmote is distributed in the hope that it will be useful,
7 but WITHOUT ANY WARRANTY; without even the implied warranty of
8 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 GNU General Public License for more details.
10 
11 You should have received a copy of the GNU General Public License
12 along with Marmote. If not, see <http://www.gnu.org/licenses/>.
13 
14 Copyright 2015 Alain Jean-Marie, Jean-Michel Fourneau, Jean-Marc Vincent, Issam Rabhi */
15 
16 #ifndef diracDistribution_H
17 #define diracDistribution_H
18 
19 #include "discreteDistribution.h"
20 
26 class diracDistribution : public virtual discreteDistribution {
27 
28 public:
34  diracDistribution( double val ); // creation from a value
35 
36 private:
37  // specific variables
38  double _value;
40 public:
41  // accessors to specific variables
47  double value(int) { return _value; };
48 
49 public:
50  // probabilistic member functions
51 
55  double getProba(double value);
56 
60  double mean();
64  double rate();
68  double moment( int order );
73  double variance();
77  double laplace( double s ); // Laplace transform at real points
81  double dLaplace( double s ); // derivative of the Laplace transform
85  double cdf( double x );
89  bool hasMoment( int order );
90 
94  diracDistribution *rescale( double factor );
99 
103  double sample();
110  void iidSample( int n, double* s );
111 
112  public:
116  std::string toString();
120  void write( FILE *out, int mode );
121 
122 };
123 
124 #endif // diracDistribution_H
double dLaplace(double s)
computing the derivative of the Laplace transform at real points
Definition: diracDistribution.cpp:135
diracDistribution * copy()
copying a distribution. Typically implemented as rescale(1.0).
Definition: diracDistribution.cpp:201
double variance()
Variance of the Dirac distribution. Reimplemented to return always 0.
Definition: diracDistribution.cpp:99
double sample()
drawing a (pseudo)random value according to the distribution.
Definition: diracDistribution.cpp:209
void iidSample(int n, double *s)
Sampling of i.i.d. values in a table. Reimplemented in order to avoid useless function calls...
Definition: diracDistribution.cpp:216
double getProba(double value)
Calculation of the mean. Returns the value since it is pre-computed.
Definition: diracDistribution.cpp:46
diracDistribution * rescale(double factor)
rescaling a distribution by some real factor. Not all distributions allow this for any real factor...
Definition: diracDistribution.cpp:191
double moment(int order)
Computing the moments of the distribution.
Definition: diracDistribution.cpp:90
The Dirac distribution concentrated at some point.
Definition: diracDistribution.h:26
diracDistribution(double val)
Unique constructor for the Dirac distribution from its value.
Definition: diracDistribution.cpp:27
double cdf(double x)
computing the cumulative distribution function at some real point x. This is the probability that the...
Definition: diracDistribution.cpp:149
std::string toString()
an utility to convert the distribution into a string.
Definition: diracDistribution.cpp:179
double rate()
computing the "rate", defined as the inverse of the mean
Definition: diracDistribution.cpp:74
bool hasMoment(int order)
test for the existence of moments of any order
Definition: diracDistribution.cpp:110
double laplace(double s)
computing the Laplace transform of the distribution at real point
Definition: diracDistribution.cpp:121
double mean()
computing the mathematical expectation or mean
Definition: diracDistribution.cpp:62
double value(int)
Read accessor to the value of the Dirac distribution.
Definition: diracDistribution.h:47
The general discrete distribution with finite support.
Definition: discreteDistribution.h:25
void write(FILE *out, int mode)
an utility to write the distribution to some file, according to some format.
Definition: diracDistribution.cpp:164