20#include <ql/math/array.hpp>
30 Real h = (upperBound - lowerBound) /
static_cast<Real
>(n);
31 for (Size i = 0; i <= n; ++i)
32 buckets_[i] = lowerBound +
static_cast<Real
>(i) * h;
42 return std::min<Size>(
buckets_.size() - 1,
43 std::max(0,
static_cast<int>(std::floor((x -
lowerBound_) /
h_) + 1)));
50 QL_REQUIRE(!
buckets_.empty(),
"Bucketing::initBuckets() no buckets given");
51 QL_REQUIRE(std::is_sorted(
buckets_.begin(),
buckets_.end()),
"buckets must be sorted");
61 Size zeroIdx =
index(0.0);
68 for (Size i = 0; i < N; ++i) {
69 if (QuantLib::close_enough(
p_[i], 0.0)) {
73 }
else if (i == N - 1) {
Bucketing(I bucketsBegin, I bucketsEnd)
std::vector< Real > buckets_
Size index(const Real x) const
probability bucketing as in Valuation of a CDO and an nth to Default CDS without Monte Carlo Simulati...
Filter close_enough(const RandomVariable &x, const RandomVariable &y)