41 #ifndef BPP_NUMERIC_PROB_DISCRETEDISTRIBUTION_H
42 #define BPP_NUMERIC_PROB_DISCRETEDISTRIBUTION_H
45 #include "../../Exceptions.h"
46 #include "../../Io/OutputStream.h"
47 #include "../NumConstants.h"
48 #include "../ParameterAliasable.h"
49 #include "../VectorTools.h"
157 virtual void set(
double category,
double probability) = 0;
170 virtual void add(
double category,
double probability) = 0;
201 virtual double rand()
const = 0;
219 virtual double qProb(
double x)
const = 0;
227 virtual double pProb(
double x)
const = 0;
The constraint interface.
Interface for discrete distribution objects.
virtual void add(double category, double probability)=0
Modify the probability associated to a class.
virtual void setMedian(bool median)=0
Sets the median value to true to say that the value in a class is proportional to the median value of...
virtual void discretize()=0
Discretizes the distribution in equiprobable classes.
virtual void setNumberOfCategories(size_t nbClasses)=0
sets the number of categories and discretizes if there is a change in this number.
virtual size_t getCategoryIndex(double value) const =0
virtual double getIInfCumulativeProbability(double category) const =0
virtual double getBound(size_t) const =0
virtual Vdouble getBounds() const =0
virtual double rand() const =0
Draw a random number from this distribution.
virtual double getProbability(double category) const =0
DiscreteDistribution * clone() const =0
Create a copy of this object and send a pointer to it.
virtual double Expectation(double a) const =0
Return a primitive function used for the expectation of the continuous version of the distribution,...
virtual double pProb(double x) const =0
Return the cumulative quantile of the continuous version of the distribution, ie .
virtual double getProbability(size_t categoryIndex) const =0
virtual bool strictLowerBound() const
virtual double getSupCumulativeProbability(double category) const =0
virtual double getUpperBound() const
virtual double getCategory(size_t categoryIndex) const =0
virtual double getLowerBound() const
methods about the range of the definition
virtual void print(OutputStream &out) const =0
Print the distribution (categories and corresponding probabilities) to a stream.
virtual Vdouble getCategories() const =0
virtual double qProb(double x) const =0
Return the quantile of the continuous version of the distribution, ie y such that .
virtual Vdouble getProbabilities() const =0
virtual double getSSupCumulativeProbability(double category) const =0
virtual double getInfCumulativeProbability(double category) const =0
virtual double randC() const =0
Draw a random number from the continuous version of this distribution, if it exists.
virtual ~DiscreteDistribution()
virtual bool strictUpperBound() const
virtual void set(double category, double probability)=0
Set the probability associated to a class.
virtual void restrictToConstraint(const Constraint &c)=0
Restricts the distribution to the domain where the constraint is respected, in addition of other pred...
virtual double getValueCategory(double value) const =0
virtual std::string getName() const =0
Get the name of the distribution.
virtual size_t getNumberOfCategories() const =0
Extend the Parametrizable interface with support for parameter aliases.
std::vector< double > Vdouble