42 virtual double CDF(
double v0,
double v1)
const = 0;
47 double PDF(
double v0,
double incr0,
48 double v1,
double incr1)
const
50 return (
CDF(v0,v1) +
CDF(v0-incr0,v1-incr1)
51 -
CDF(v0-incr0,v1) -
CDF(v0,v1-incr1));
57 double PDF(
double v0,
double v1,
double incr)
const
59 return PDF(v0,incr,v1,incr);
86 vector<BCEDistr*>::iterator distr;
126 for (vector<BCEDistr*>::const_iterator it =
distributions.begin();
133 || (distrArray != NULL
144 vector<BCEDistr*>::iterator distr;
154 double CDF(
double v0,
double v1)
const
156 vector<BCEDistr*>::const_iterator distr;
157 vector<double>::const_iterator weight;
164 p += *weight * (*distr)->CDF(v0,v1);
188 unimodal(
double _c0,
double _m0,
int _k0,
189 double _c1,
double _m1,
int _k1):
190 c0(_c0), k0(_k0), m0(_m0),
191 c1(_c1), k1(_k1), m1(_m1)
194 d0 = 1.0/c0+pow(1-m0,k0)-e0;
196 d1 = 1.0/c1+pow(1-m1,k1)-e1;
199 unimodal(
double _c,
double _m,
int _k):
200 c0(_c), k0(_k), m0(_m),
201 c1(_c), k1(_k), m1(_m)
204 d0 = 1.0/c0+pow(1-m0,k0)-e0;
208 double CDF (
double v0,
double v1)
const
214 p *= c0*( d0*v0 + pow(v0-m0,k0) + e0 );
219 p *= c1*( d1*v1 + pow(v1-m1,k1) + e1 );
231 double CDF(
double v0,
double v1)
const
233 v0 = min(max(v0,0.0),1.0);
234 v1 = min(max(v1,0.0),1.0);
235 return (v0+v1)*(v0+v1)*v0*v1/4;
245 double CDF(
double v0,
double v1)
const
269 bernoulli(
double _lowProb): lowProb(_lowProb) {};
271 double CDF(
double v0,
double v1)
const
298 double CDF(
double v0,
double v1)
const
329 double CDF(
double v0,
double v1)
const
342 if (abs(v0-v1)<(0.5/k))
369 double CDF(
double v0,
double v1)
const
417 double _min,
double _max):
429 double _min0,
double _min1,
430 double _max0,
double _max1):
442 double CDF(
double v0,
double v1)
const
454 if (v0 <
min0-1e-13 || v1 <
min1-1e-13)
Weighted sum of distributions.
Definition: bcedistr.hpp:71
vector< double > weights
Weights corresponding to distributions.
Definition: bcedistr.hpp:76
vector< BCEDistr * > distributions
Vector of pointers to distributions.
Definition: bcedistr.hpp:74
bool contains(BCEDistr *distr) const
Recursive check if BCEDistr contains distr.
Definition: bcedistr.hpp:117
~BCEDistrArray()
Destructor.
Definition: bcedistr.hpp:84
bool push_back(BCEDistr *newDistr, double newWeight)
Add a new distribution to the array.
Definition: bcedistr.hpp:97
void clear()
Deletes all of the distributions in the array.
Definition: bcedistr.hpp:142
BCEDistrArray()
Default constructor.
Definition: bcedistr.hpp:80
double CDF(double v0, double v1) const
Implements BCEDistr::CDF to calculate the weighted sum of CDFs.
Definition: bcedistr.hpp:154
Utility class for probability distributions.
Definition: bcedistr.hpp:39
double PDF(double v0, double v1, double incr) const
Discretized PDF for the BCEDistr.
Definition: bcedistr.hpp:57
virtual double CDF(double v0, double v1) const =0
The joint CDF of the distribution.
virtual ~BCEDistr()
Virtual destructor.
Definition: bcedistr.hpp:63
double PDF(double v0, double incr0, double v1, double incr1) const
Discretized PDF for the BCEDistr.
Definition: bcedistr.hpp:47
Bernoulli distribution.
Definition: bcedistr.hpp:265
double CDF(double v0, double v1) const
The joint CDF of the distribution.
Definition: bcedistr.hpp:271
Truncated version of a distribution.
Definition: bcedistr.hpp:389
double CDF(double v0, double v1) const
Implements BCEDistr::CDF.
Definition: bcedistr.hpp:442
BCEDistr * dist
The distribution being truncated.
Definition: bcedistr.hpp:392
double min1
Minimum 1 coordinate.
Definition: bcedistr.hpp:396
truncated(BCEDistr *_dist, double _min, double _max)
Constructor.
Definition: bcedistr.hpp:416
truncated(BCEDistr *_dist)
Constructor.
Definition: bcedistr.hpp:405
double max0
Maximum 0 coordinate.
Definition: bcedistr.hpp:398
double min0
Minimum 0 coordinate.
Definition: bcedistr.hpp:394
double max1
Maximum 1 coordinate.
Definition: bcedistr.hpp:400
truncated(BCEDistr *_dist, double _min0, double _min1, double _max0, double _max1)
Constructor.
Definition: bcedistr.hpp:428
Unimodal distribution.
Definition: bcedistr.hpp:174
double CDF(double v0, double v1) const
The joint CDF of the distribution.
Definition: bcedistr.hpp:208
CDF is of the form .
Definition: bcedistr.hpp:352
double CDF(double v0, double v1) const
The joint CDF of the distribution.
Definition: bcedistr.hpp:369