BCESolve
|
Weighted sum of distributions. More...
#include <bcedistr.hpp>
Public Member Functions | |
BCEDistrArray () | |
Default constructor. More... | |
~BCEDistrArray () | |
Destructor. More... | |
bool | push_back (BCEDistr *newDistr, double newWeight) |
Add a new distribution to the array. More... | |
bool | contains (BCEDistr *distr) const |
Recursive check if BCEDistr contains distr. More... | |
void | clear () |
Deletes all of the distributions in the array. | |
double | CDF (double v0, double v1) const |
Implements BCEDistr::CDF to calculate the weighted sum of CDFs. More... | |
Public Member Functions inherited from BCEDistr | |
virtual double | CDF (double v0, double v1) const =0 |
The joint CDF of the distribution. More... | |
double | PDF (double v0, double incr0, double v1, double incr1) const |
Discretized PDF for the BCEDistr. More... | |
double | PDF (double v0, double v1, double incr) const |
Discretized PDF for the BCEDistr. More... | |
virtual | ~BCEDistr () |
Virtual destructor. | |
Public Attributes | |
vector< BCEDistr * > | distributions |
Vector of pointers to distributions. | |
vector< double > | weights |
Weights corresponding to distributions. | |
Weighted sum of distributions.
This class creates a new distribution out of a convex combination of distributions. It can be used recursively, i.e., to create convex combinations of convex combinations.
|
inline |
Default constructor.
Creates an empty BCEDistrArray.
|
inline |
Destructor.
Deletes all of the member distributions.
|
inlinevirtual |
Implements BCEDistr::CDF to calculate the weighted sum of CDFs.
Implements BCEDistr.
|
inline |
Recursive check if BCEDistr contains distr.
Since BCEDistrArray derives from BCEDistr, it is possible to have distribution arrays that are elements of distribution arrays. We do not want recursive nightmares where a BCEDistrArray contains itself. This function checks if the given distr is an element, and if any of the elements are themselves arrays, recursively checks whether or not the distr is contained in any of the elements.
|
inline |
Add a new distribution to the array.
This method appends a new distribution to the array with the corresponding weight. Returns true in the event of a failure.