bpp-core3  3.0.0
UniformDiscreteDistribution.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 "../Random/RandomTools.h"
8 
9 using namespace bpp;
10 
11 // From the STL:
12 #include <cmath>
13 
14 using namespace std;
15 
18 UniformDiscreteDistribution::UniformDiscreteDistribution(unsigned int n, double min, double max) :
19  AbstractDiscreteDistribution(n, "Uniform."),
20  min_((min < max) ? min : max),
21  max_((min < max) ? max : min)
22 {
23  intMinMax_->setLowerBound(min_, false);
24  intMinMax_->setUpperBound(max_, false);
25 
26  discretize();
27 }
28 
31  min_(udd.min_),
32  max_(udd.max_)
33 {}
34 
36 {
38  min_ = udd.min_;
39  max_ = udd.max_;
40 
41  return *this;
42 }
43 
45 
46 /******************************************************************************/
47 
49 {}
Partial implementation of the DiscreteDistribution interface.
UniformDiscreteDistribution & operator=(const UniformDiscreteDistribution &)
STL namespace.
void fireParameterChanged(const ParameterList &parameters)
Notify the class when one or several parameters have changed.
The parameter list object.
Definition: ParameterList.h:27
AbstractDiscreteDistribution & operator=(const AbstractDiscreteDistribution &adde)
std::shared_ptr< IntervalConstraint > intMinMax_
the interval where the distribution is defined/restricted.
virtual void discretize()
Discretizes the distribution in equiprobable classes.
UniformDiscreteDistribution(unsigned int n, double min=0., double max=1.)
Build a new discretized uniform distribution.
Discretized Uniform distribution. All categories are equidistributed all along a given interval...