35 const std::vector<Real>& accruals,
36 const std::vector<Time>& paymentTimes,
37 const std::vector<Rate>& strikes)
38 : rateTimes_(rateTimes),
40 paymentTimes_(paymentTimes),
42 numberRates_(accruals_.size())
50 "rateTimes.size()<> numberOfRates+1");
53 "paymentTimes.size()<> numberOfRates");
56 "accruals.size()<> numberOfRates");
59 "strikes.size()<> numberOfRates");
71 std::vector<Size>& numberCashFlowsThisStep,
72 std::vector<std::vector<MarketModelPathwiseMultiProduct::CashFlow> >& cashFlowsGenerated)
79 std::fill(numberCashFlowsThisStep.begin(),
80 numberCashFlowsThisStep.end(),0);
94 std::unique_ptr<MarketModelPathwiseMultiProduct>
145 const std::vector<Real>& accruals,
146 const std::vector<Time>& paymentTimes,
147 const std::vector<Rate>& strikes)
148 : rateTimes_(rateTimes),
150 paymentTimes_(paymentTimes),
152 numberRates_(accruals_.size())
157 evolTimes.pop_back();
160 "rateTimes.size()<> numberOfRates+1");
163 "paymentTimes.size()<> numberOfRates");
166 "accruals.size()<> numberOfRates");
169 "strikes.size()<> numberOfRates");
177 const std::vector<Real>& accruals,
178 const std::vector<Time>& paymentTimes,
180 : rateTimes_(rateTimes),
182 paymentTimes_(paymentTimes),
183 strikes_(accruals.size()) ,
184 numberRates_(accruals_.size())
189 evolTimes.pop_back();
192 "rateTimes.size()<> numberOfRates+1");
195 "paymentTimes.size()<> numberOfRates");
198 "accruals.size()<> numberOfRates");
211 std::vector<Size>& numberCashFlowsThisStep,
212 std::vector<std::vector<MarketModelPathwiseMultiProduct::CashFlow> >& cashFlowsGenerated)
219 std::fill(numberCashFlowsThisStep.begin(),
220 numberCashFlowsThisStep.end(),0);
241 std::unique_ptr<MarketModelPathwiseMultiProduct>
283 const std::vector<Time>& rateTimes,
284 const std::vector<Real>& accruals,
285 const std::vector<Time>& paymentTimes,
287 std::vector<std::pair<Size, Size> > startsAndEnds)
288 : underlyingCaplets_(rateTimes, accruals, paymentTimes, strike), numberRates_(accruals.size()),
289 startsAndEnds_(
std::move(startsAndEnds)) {
302 i[j].amount.resize(accruals.size() + 1);
348 std::vector<Size>& numberCashFlowsThisStep,
349 std::vector<std::vector<MarketModelPathwiseMultiProduct::CashFlow> >& cashFlowsGenerated)
355 numberCashFlowsThisStep[k]=0;
375 std::unique_ptr<MarketModelPathwiseMultiProduct>
Curve state for market-model simulations
virtual Rate forwardRate(Size i) const =0
virtual Real discountRatio(Size i, Size j) const =0
Market-model evolution description.
market-model pathwise caplet
std::vector< Time > paymentTimes_
std::vector< Size > suggestedNumeraires() const override
MarketModelPathwiseMultiCaplet(const std::vector< Time > &rateTimes, const std::vector< Real > &accruals, const std::vector< Time > &paymentTimes, const std::vector< Rate > &strikes)
bool nextTimeStep(const CurveState ¤tState, std::vector< Size > &numberCashFlowsThisStep, std::vector< std::vector< MarketModelPathwiseMultiProduct::CashFlow > > &cashFlowsGenerated) override
return value indicates whether path is finished, TRUE means done
std::unique_ptr< MarketModelPathwiseMultiProduct > clone() const override
returns a newly-allocated copy of itself
bool alreadyDeflated() const override
std::vector< Time > possibleCashFlowTimes() const override
const EvolutionDescription & evolution() const override
Size maxNumberOfCashFlowsPerProductPerStep() const override
EvolutionDescription evolution_
Size numberOfProducts() const override
std::vector< Rate > strikes_
std::vector< Real > rateTimes_
std::vector< Real > accruals_
void reset() override
during simulation put product at start of path
std::vector< Size > suggestedNumeraires() const override
MarketModelPathwiseMultiDeflatedCap(const std::vector< Time > &rateTimes, const std::vector< Real > &accruals, const std::vector< Time > &paymentTimes, Rate strike, std::vector< std::pair< Size, Size > > startsAndEnds)
bool nextTimeStep(const CurveState ¤tState, std::vector< Size > &numberCashFlowsThisStep, std::vector< std::vector< MarketModelPathwiseMultiProduct::CashFlow > > &cashFlowsGenerated) override
return value indicates whether path is finished, TRUE means done
std::unique_ptr< MarketModelPathwiseMultiProduct > clone() const override
returns a newly-allocated copy of itself
MarketModelPathwiseMultiDeflatedCaplet underlyingCaplets_
std::vector< std::pair< Size, Size > > startsAndEnds_
bool alreadyDeflated() const override
std::vector< Time > possibleCashFlowTimes() const override
const EvolutionDescription & evolution() const override
Size maxNumberOfCashFlowsPerProductPerStep() const override
std::vector< std::vector< MarketModelPathwiseMultiProduct::CashFlow > > innerCashFlowsGenerated_
Size numberOfProducts() const override
std::vector< Size > innerCashFlowSizes_
void reset() override
during simulation put product at start of path
std::vector< Time > paymentTimes_
std::vector< Size > suggestedNumeraires() const override
MarketModelPathwiseMultiDeflatedCaplet(const std::vector< Time > &rateTimes, const std::vector< Real > &accruals, const std::vector< Time > &paymentTimes, const std::vector< Rate > &strikes)
bool nextTimeStep(const CurveState ¤tState, std::vector< Size > &numberCashFlowsThisStep, std::vector< std::vector< MarketModelPathwiseMultiProduct::CashFlow > > &cashFlowsGenerated) override
return value indicates whether path is finished, TRUE means done
std::unique_ptr< MarketModelPathwiseMultiProduct > clone() const override
returns a newly-allocated copy of itself
bool alreadyDeflated() const override
std::vector< Time > possibleCashFlowTimes() const override
const EvolutionDescription & evolution() const override
Size maxNumberOfCashFlowsPerProductPerStep() const override
EvolutionDescription evolution_
Size numberOfProducts() const override
std::vector< Rate > strikes_
std::vector< Real > rateTimes_
std::vector< Real > accruals_
void reset() override
during simulation put product at start of path
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
std::size_t Size
size of a container
void checkIncreasingTimes(const std::vector< Time > ×)
check for strictly increasing times, first time greater than zero