BCESolve
BCEDistrArray Class Reference

Weighted sum of distributions. More...

#include <bcedistr.hpp>

Inheritance diagram for BCEDistrArray:
Collaboration diagram for BCEDistrArray:

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.
 

Detailed Description

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.

Examples
duopoly.hpp, fpagame.hpp, and fpaunknown.hpp.

Constructor & Destructor Documentation

◆ BCEDistrArray()

BCEDistrArray::BCEDistrArray ( )
inline

Default constructor.

Creates an empty BCEDistrArray.

◆ ~BCEDistrArray()

BCEDistrArray::~BCEDistrArray ( )
inline

Destructor.

Deletes all of the member distributions.

Member Function Documentation

◆ CDF()

double BCEDistrArray::CDF ( double  v0,
double  v1 
) const
inlinevirtual

Implements BCEDistr::CDF to calculate the weighted sum of CDFs.

Implements BCEDistr.

◆ contains()

bool BCEDistrArray::contains ( BCEDistr distr) const
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.

◆ push_back()

bool BCEDistrArray::push_back ( BCEDistr newDistr,
double  newWeight 
)
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.

Examples
duopoly.hpp, fpagame.hpp, and fpaunknown.hpp.

The documentation for this class was generated from the following file: