31 : underlying_(underlying), strategy_(strategy), rebate_(
std::move(rebate)) {
34 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(),
45 "incompatible rate times");
50 Matrix amounts(products, exerciseTimes.size(), 0.0);
56 std::vector<Time> mergedEvolutionTimes;
57 std::vector<std::vector<Time> > allEvolutionTimes(4);
58 allEvolutionTimes[0] = evolutionTimes1;
59 allEvolutionTimes[1] = exerciseTimes;
60 allEvolutionTimes[2] =
rebate_->evolution().evolutionTimes();
72 const std::vector<Time> rebateTimes =
rebate_->possibleCashFlowTimes();
74 rebateTimes.begin(), rebateTimes.end());
77 Size n =
rebate_->maxNumberOfCashFlowsPerProductPerStep();
79 std::vector<std::vector<CashFlow> >(products,
80 std::vector<CashFlow>(
n));
108 return std::max(
underlying_->maxNumberOfCashFlowsPerProductPerStep(),
109 rebate_->maxNumberOfCashFlowsPerProductPerStep());
124 std::vector<Size>& numberCashFlowsThisStep,
125 std::vector<std::vector<CashFlow> >& cashFlowsGenerated)
146 done =
rebate_->nextTimeStep(currentState,
147 numberCashFlowsThisStep,
149 for (
Size i=0; i<numberCashFlowsThisStep.size(); ++i)
150 for (
Size j=0; j<numberCashFlowsThisStep[i]; ++j)
157 rebate_->nextTimeStep(currentState,
160 if (isUnderlyingTime)
162 numberCashFlowsThisStep,
170 std::unique_ptr<MarketModelMultiProduct>
const ExerciseStrategy< CurveState > & strategy() const
std::vector< Size > suggestedNumeraires() const override
std::vector< std::vector< CashFlow > > dummyCashFlowsGenerated_
std::unique_ptr< MarketModelMultiProduct > clone() const override
returns a newly-allocated copy of itself
const MarketModelMultiProduct & underlying() const
bool nextTimeStep(const CurveState ¤tState, std::vector< Size > &numberCashFlowsThisStep, std::vector< std::vector< CashFlow > > &cashFlowsGenerated) override
return value indicates whether path is finished, TRUE means done
CallSpecifiedMultiProduct(const Clone< MarketModelMultiProduct > &underlying, const Clone< ExerciseStrategy< CurveState > > &, Clone< MarketModelMultiProduct > rebate=Clone< MarketModelMultiProduct >())
std::vector< Time > possibleCashFlowTimes() const override
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_
Clone< MarketModelMultiProduct > rebate_
Clone< MarketModelMultiProduct > underlying_
const MarketModelMultiProduct & rebate() const
Size numberOfProducts() const override
std::vector< std::valarray< bool > > isPresent_
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.
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
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
void mergeTimes(const std::vector< std::vector< Time > > ×, std::vector< Time > &mergedTimes, std::vector< std::valarray< bool > > &isPresent)