bpp-core3  3.0.0
GaussianDiscreteDistribution.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: The Bio++ Development Group
2 //
3 // SPDX-License-Identifier: CECILL-2.1
4 
5 #ifndef BPP_NUMERIC_PROB_GAUSSIANDISCRETEDISTRIBUTION_H
6 #define BPP_NUMERIC_PROB_GAUSSIANDISCRETEDISTRIBUTION_H
7 
8 
9 #include "../Constraints.h"
10 #include "../Random/RandomTools.h"
12 
13 namespace bpp
14 {
22 {
23 private:
24  double mu_, sigma_;
25 
26 public:
37  GaussianDiscreteDistribution(size_t n, double mu = 0., double sigma = 1.);
38 
40 
42 
44 
46 
47 public:
48  std::string getName() const {return "Gaussian";}
49 
50  void fireParameterChanged(const ParameterList& parameters);
51 
52  double randC() const
53  {
54  return RandomTools::randGaussian(mu_, sigma_);
55  }
56 
57  double qProb(double x) const;
58 
59  double pProb(double x) const;
60 
61  double Expectation(double a) const;
62 };
63 } // end of namespace bpp.
64 #endif // BPP_NUMERIC_PROB_GAUSSIANDISCRETEDISTRIBUTION_H
double qProb(double x) const
Return the quantile of the continuous version of the distribution, ie y such that ...
Partial implementation of the DiscreteDistribution interface.
double randC() const
Draw a random number from the continuous version of this distribution, if it exists.
Discretized Gaussian distribution.
The parameter list object.
Definition: ParameterList.h:27
double pProb(double x) const
Return the cumulative quantile of the continuous version of the distribution, ie .
void fireParameterChanged(const ParameterList &parameters)
Notify the class when one or several parameters have changed.
GaussianDiscreteDistribution(size_t n, double mu=0., double sigma=1.)
Build a new discretized normal distribution.
std::string getName() const
Get the name of the distribution.
GaussianDiscreteDistribution & operator=(const GaussianDiscreteDistribution &)
GaussianDiscreteDistribution * clone() const
Create a copy of this object and send a pointer to it.
double Expectation(double a) const
Return a primitive function used for the expectation of the continuous version of the distribution...
static double randGaussian(double mean, double variance)
Definition: RandomTools.h:116