Marmote Core
The project aims at realizing the prototype of a software environment dedicated to modeling with Markov chains.
exponentialDistribution.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 EXPONENTIALDISTRIBUTION_H
17 #define EXPONENTIALDISTRIBUTION_H
18 
19 #include "discreteDistribution.h"
20 
25 class exponentialDistribution : public virtual Distribution {
26 
27 public:
28  // constructors
35  exponentialDistribution( double val ); // creation from a value
36 
37 private:
38  // specific variables
39  double _rate;
41 public:
42  // accessors
48  double rate() { return _rate; }
49 
50 public:
51  // probabilistic member functions
57  double mean() { return _mean; };
58 
62  double moment( int order );
66  double laplace( double s ); // Laplace transform at real points
70  double dLaplace( double s ); // derivative of the Laplace transform
74  double cdf( double x );
81  bool hasMoment( int order );
82 
86  exponentialDistribution *rescale( double factor );
91 
97  double sample();
98 
99  public:
105  std::string toString();
112  void write( FILE *out, int mode );
113 
114 };
115 
116 #endif // EXPONENTIALDISTRIBUTION_H
double sample()
Sampling from the law. Uses the mother class method.
Definition: exponentialDistribution.cpp:176
double mean()
Calculation of the mean. Returns the value since it is pre-computed.
Definition: exponentialDistribution.h:57
The class representing the (negative) exponential distribution.
Definition: exponentialDistribution.h:25
exponentialDistribution * copy()
copying a distribution. Typically implemented as rescale(1.0).
Definition: exponentialDistribution.cpp:168
std::string toString()
Printing a representation of the law into a string.
Definition: exponentialDistribution.cpp:146
double cdf(double x)
computing the cumulative distribution function at some real point x. This is the probability that the...
Definition: exponentialDistribution.cpp:111
A class for representing probability distributions.
Definition: Distribution.h:44
double moment(int order)
Computing the moments of the distribution.
Definition: exponentialDistribution.cpp:42
exponentialDistribution * rescale(double factor)
rescaling a distribution by some real factor. Not all distributions allow this for any real factor...
Definition: exponentialDistribution.cpp:158
bool hasMoment(int order)
Test of existence of a moment. These distributions always have one.
Definition: exponentialDistribution.cpp:73
exponentialDistribution(double val)
Unique constructor for the exponential distribution, from its average. The rate is computed at creati...
Definition: exponentialDistribution.cpp:21
double laplace(double s)
computing the Laplace transform of the distribution at real point
Definition: exponentialDistribution.cpp:79
double _mean
Definition: Distribution.h:240
double rate()
Read accessor for the rate.
Definition: exponentialDistribution.h:48
void write(FILE *out, int mode)
Definition: exponentialDistribution.cpp:135
double dLaplace(double s)
computing the derivative of the Laplace transform at real points
Definition: exponentialDistribution.cpp:95