37 factorBegin_(factorBegin),
38 factorEnd_(factorEnd),
39 rateBegin_(rateBegin),
41 stepBegin_(stepBegin),
78 if (
rateEnd_ > volStructure->numberOfRates())
81 if (
stepEnd_ > volStructure->numberOfSteps())
84 if (
factorEnd_ > volStructure->numberOfFactors())
87 Size firstAliveRate = volStructure->evolution().firstAliveRate()[
stepEnd_-1];
95 bool factorwiseBumping)
96 : associatedVolStructure_(volStructure)
98 Size steps = volStructure->numberOfSteps();
99 Size rates = volStructure->numberOfRates();
100 Size factors = volStructure->numberOfFactors();
103 for (
Size r=volStructure->evolution().firstAliveRate()[
s];
r < rates; ++
r)
105 if (factorwiseBumping)
107 for (
Size f=0;
f < factors; ++
f)
131 ext::shared_ptr<MarketModel> volStructure)
132 : allBumps_(
std::move(allBumps)), associatedVolStructure_(
std::move(volStructure)),
136 "incompatible bumps passed to VegaBumpCollection");
149 std::vector<std::vector<std::valarray<bool> > >
v;
153 std::valarray<bool> model(
false,factors);
156 std::vector<std::valarray<bool> > modelTwo;
158 modelTwo.push_back(model);
161 v.push_back(modelTwo);
164 for (
Size f = allBump.factorBegin();
f < allBump.factorEnd(); ++
f)
165 for (
Size r = allBump.rateBegin();
r < allBump.rateEnd(); ++
r)
166 for (
Size s = allBump.stepBegin();
s < allBump.stepEnd(); ++
s)
170 Size numberFailures =0;
177 return numberFailures>0;
187 std::vector<std::vector<std::valarray<bool> > >
v;
192 std::valarray<bool> model(
false,factors);
195 std::vector<std::valarray<bool> > modelTwo;
197 modelTwo.push_back(model);
200 v.push_back(modelTwo);
202 Size numberFailures=0;
205 for (
Size f = allBump.factorBegin();
f < allBump.factorEnd(); ++
f)
206 for (
Size r = allBump.rateBegin();
r < allBump.rateEnd(); ++
r)
207 for (
Size s = allBump.stepBegin();
s < allBump.stepEnd(); ++
s) {
214 return numberFailures>0;
bool doesIntersect(const VegaBumpCluster &comparee) const
bool isCompatible(const ext::shared_ptr< MarketModel > &volStructure) const
VegaBumpCluster(Size factorBegin, Size factorEnd, Size rateBegin, Size rateEnd, Size stepBegin, Size stepEnd)
VegaBumpCollection(const ext::shared_ptr< MarketModel > &volStructure, bool allowFactorwiseBumping=true)
ext::shared_ptr< MarketModel > associatedVolStructure_
const std::vector< VegaBumpCluster > & allBumps() const
bool isNonOverlapping() const
std::vector< VegaBumpCluster > allBumps_
Classes and functions for error handling.
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
std::size_t Size
size of a container
ext::shared_ptr< YieldTermStructure > r
ext::shared_ptr< BlackVolTermStructure > v