32 : underlying_(underlying), strategy_(strategy), rebate_(
std::move(rebate)) {
35 const std::vector<Time>& rateTimes1 = d1.
rateTimes();
41 const std::vector<Time>& rateTimes2 = d2.
rateTimes();
42 QL_REQUIRE(rateTimes1.size() == rateTimes2.size() &&
43 std::equal(rateTimes1.begin(), rateTimes1.end(), rateTimes2.begin()),
44 "incompatible rate times");
47 "incompatible deflations");
50 Matrix amounts(products, exerciseTimes.size(), 0.0);
55 std::vector<Time> mergedEvolutionTimes;
56 std::vector<std::vector<Time> > allEvolutionTimes(4);
57 allEvolutionTimes[0] = evolutionTimes1;
58 allEvolutionTimes[1] = exerciseTimes;
59 allEvolutionTimes[2] =
rebate_->evolution().evolutionTimes();
69 const std::vector<Time> rebateTimes =
rebate_->possibleCashFlowTimes();
73 Size n =
rebate_->maxNumberOfCashFlowsPerProductPerStep();
79 std::vector<std::vector<CashFlow> >(products, std::vector<CashFlow>(
n, modelCashFlow));
103 return std::max(
underlying_->maxNumberOfCashFlowsPerProductPerStep(),
104 rebate_->maxNumberOfCashFlowsPerProductPerStep());
118 std::vector<Size>& numberCashFlowsThisStep,
119 std::vector<std::vector<CashFlow> >& cashFlowsGenerated) {
137 done =
rebate_->nextTimeStep(currentState, numberCashFlowsThisStep,
139 for (
Size i = 0; i < numberCashFlowsThisStep.size(); ++i)
140 for (
Size j = 0; j < numberCashFlowsThisStep[i]; ++j)
147 if (isUnderlyingTime)
148 done =
underlying_->nextTimeStep(currentState, numberCashFlowsThisStep,
156 std::unique_ptr<MarketModelPathwiseMultiProduct>
const ExerciseStrategy< CurveState > & strategy() const
std::vector< Size > suggestedNumeraires() const override
Clone< MarketModelPathwiseMultiProduct > underlying_
Clone< MarketModelPathwiseMultiProduct > rebate_
std::vector< std::vector< CashFlow > > dummyCashFlowsGenerated_
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 MarketModelPathwiseMultiProduct & underlying() const
CallSpecifiedPathwiseMultiProduct(const Clone< MarketModelPathwiseMultiProduct > &underlying, const Clone< ExerciseStrategy< CurveState > > &, Clone< MarketModelPathwiseMultiProduct > rebate=Clone< MarketModelPathwiseMultiProduct >())
const EvolutionDescription & evolution() const override
void disableCallability()
Clone< ExerciseStrategy< CurveState > > strategy_
Size maxNumberOfCashFlowsPerProductPerStep() const override
EvolutionDescription evolution_
std::vector< Time > cashFlowTimes_
std::vector< Size > dummyCashFlowsThisStep_
Size numberOfProducts() const override
std::vector< std::valarray< bool > > isPresent_
const MarketModelPathwiseMultiProduct & rebate() const
void reset() override
during simulation put product at start of path
cloning proxy to an underlying object
Curve state for market-model simulations
Market-model evolution description.
Size numberOfRates() const
const std::vector< Time > & rateTimes() const
const std::vector< Time > & evolutionTimes() const
virtual std::vector< Time > exerciseTimes() const =0
virtual std::vector< Time > relevantTimes() const =0
market-model pathwise product
virtual const EvolutionDescription & evolution() const =0
Matrix used in linear algebra.
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
std::size_t Size
size of a container
matrix used in linear algebra.
void mergeTimes(const std::vector< std::vector< Time > > ×, std::vector< Time > &mergedTimes, std::vector< std::valarray< bool > > &isPresent)
std::vector< Real > amount