bpp-core3  3.0.0
ExponentialDiscreteDistribution.cpp
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: The Bio++ Development Group
2 //
3 // SPDX-License-Identifier: CECILL-2.1
4 
5 #include "../../Utils/MapTools.h"
6 #include "../NumConstants.h"
7 #include "../Random/RandomTools.h"
9 
10 using namespace bpp;
11 
12 // From the STL:
13 #include <cmath>
14 using namespace std;
15 
16 /****************************************************************/
17 
19  AbstractDiscreteDistribution(n, "Exponential."),
20  lambda_(lambda)
21 {
22  addParameter_(new Parameter("Exponential.lambda", lambda, Parameter::R_PLUS));
23 
24  intMinMax_->setLowerBound(0, true);
25  discretize();
26 }
27 
28 /******************************************************************************/
29 
31 {
33  lambda_ = getParameterValue("lambda");
34  discretize();
35 }
static const std::shared_ptr< IntervalConstraint > R_PLUS
Definition: Parameter.h:307
Partial implementation of the DiscreteDistribution interface.
STL namespace.
This class is designed to facilitate the manipulation of parameters.
Definition: Parameter.h:97
void addParameter_(Parameter *parameter)
double getParameterValue(const std::string &name) const override
Get the value for parameter of name &#39;name&#39;.
The parameter list object.
Definition: ParameterList.h:27
virtual void fireParameterChanged(const ParameterList &parameters)
Notify the class when one or several parameters have changed.
void fireParameterChanged(const ParameterList &parameters)
Notify the class when one or several parameters have changed.
std::shared_ptr< IntervalConstraint > intMinMax_
the interval where the distribution is defined/restricted.
virtual void discretize()
Discretizes the distribution in equiprobable classes.
ExponentialDiscreteDistribution(size_t n, double lambda=1.)
Build a new discretized exponential distribution.