Represents a bucketed probability distibution. More...
#include <qle/math/bucketeddistribution.hpp>
Public Member Functions | |
BucketedDistribution () | |
Default constructor. | |
BucketedDistribution (QuantLib::Real min, QuantLib::Real max, QuantLib::Size numberBuckets) | |
Build a default initial distribution from min and max and numberBuckets . | |
BucketedDistribution (QuantLib::Real min, QuantLib::Real max, QuantLib::Size numberBuckets, QuantLib::Real initialValue) | |
BucketedDistribution (const std::vector< QuantLib::Real > &buckets, const std::vector< QuantLib::Real > &initialProbabilities, const std::vector< QuantLib::Real > &initialPoints) | |
Explicitly specify the initial distribution. | |
BucketedDistribution (const BucketedDistribution &other) | |
Copy constructor. | |
void | add (const DiscreteDistribution &distribution) |
Update the bucketed distribution by adding a discrete distribution. | |
const std::vector< QuantLib::Real > & | buckets () const |
Return the buckets of the distribution. | |
const std::vector< QuantLib::Real > & | probabilities () const |
Get the probabilities. | |
std::vector< QuantLib::Real > & | probabilities () |
Set the probabilities. | |
const std::vector< QuantLib::Real > & | points () const |
Return the points of the distribution. | |
Size | numberBuckets () const |
Return the number of buckets in the distribution. | |
std::vector< QuantLib::Real > | cumulativeProbabilities () const |
Return the cumulative probabilities of the distribution. | |
std::vector< QuantLib::Real > | complementaryProbabilities () const |
Return 1.0 minus the cumulative probabilities of the distribution. | |
void | applyShift (QuantLib::Real shift) |
Shift all buckets and points by an additive shift . | |
void | applyFactor (QuantLib::Real factor) |
Shift all buckets and points by a multiplicative factor . | |
Real | cumulativeProbability (QuantLib::Real x) const |
Return cumulative probability at point x using linear interpolation. | |
Real | inverseCumulativeProbability (QuantLib::Real p) const |
Return inverse cumulative probability given a probability p using linear interpolation. | |
BucketedDistribution & | operator+= (const BucketedDistribution &other) |
Utility functions. | |
DiscreteDistribution | createDiscrete () const |
Create a DiscreteDistribution from a BucketedDistribution with discrete points at midpoints of the buckets. | |
void | erase (QuantLib::Size n) |
Erase the first n buckets from the distribution. More... | |
QuantLib::Size | bucket (QuantLib::Real value) const |
Returns the index of the bucket containing value. | |
Represents a bucketed probability distibution.
BucketedDistribution | ( | QuantLib::Real | min, |
QuantLib::Real | max, | ||
QuantLib::Size | numberBuckets, | ||
QuantLib::Real | initialValue | ||
) |
Build a default initial distribution from min
and max
and numberBuckets
and set all probabilities to initialValue
void erase | ( | QuantLib::Size | n | ) |
Erase the first n
buckets from the distribution.