31 ext::shared_ptr<MarketModelEvolver> evolver,
32 std::vector<std::vector<ext::shared_ptr<ConstrainedEvolver> > > constrainedEvolvers,
33 std::vector<std::vector<std::vector<Real> > > diffWeights,
34 std::vector<Size> startIndexOfConstraint,
35 std::vector<Size> endIndexOfConstraint,
37 Real initialNumeraireValue)
38 : originalEvolver_(
std::move(evolver)), constrainedEvolvers_(
std::move(constrainedEvolvers)),
39 diffWeights_(
std::move(diffWeights)),
40 startIndexOfConstraint_(
std::move(startIndexOfConstraint)),
41 endIndexOfConstraint_(
std::move(endIndexOfConstraint)), product_(product),
42 initialNumeraireValue_(initialNumeraireValue), numberProducts_(product->numberOfProducts()),
43 numerairesHeld_(product->numberOfProducts()),
48 product_->maxNumberOfCashFlowsPerProductPerStep());
50 const std::vector<Time>& cashFlowTimes =
52 const std::vector<Rate>& rateTimes =
product_->evolution().rateTimes();
53 Size n = cashFlowTimes.size();
55 for (
Size j=0; j<
n; ++j)
57 const std::vector<Rate>& evolutionTimes =
58 product_->evolution().evolutionTimes();
64 std::vector<Real>& values,
65 std::vector<std::vector<std::vector<Real> > >& modifiedValues) {
72 modifiedValues[i][j]);
79 std::vector<std::vector<SequenceStatisticsInc> >& modifiedStats,
83 std::vector<Real> values(N);
84 std::vector<std::vector<std::vector<Real> > > modifiedValues;
86 for (
Size i=0; i<modifiedValues.size(); ++i) {
88 for (
auto& j : modifiedValues[i])
94 for (
Size i=0; i<numberOfPaths; ++i) {
101 for (
Size l=0; l<N; ++l) {
102 results[l] = weights[0]*values[l];
103 for (
Size n=1;
n<weights.size(); ++
n)
104 results[l] += weights[
n]*modifiedValues[j][
n-1][l];
106 modifiedStats[j][k].add(
results);
113 std::vector<Real>& values,
119 Real principalInNumerairePortfolio = 1.0;
148 const std::vector<MarketModelMultiProduct::CashFlow>& cashflows =
157 Real bonds = cashflows[j].amount *
164 weight*bonds/principalInNumerairePortfolio;
179 principalInNumerairePortfolio *=
cloning proxy to an underlying object
Rate swapRate(Size begin, Size end) const
virtual Real discountRatio(Size i, Size j) const =0
Statistics analysis of N-dimensional (sequence) data.
void add(const Sequence &sample, Real weight=1.0)
Real numeraireBonds(const CurveState &, Size numeraire) const
virtual const std::vector< Size > & numeraires() const =0
virtual Real advanceStep()=0
virtual const CurveState & currentState() const =0
virtual Size currentStep() const =0
virtual Real startNewPath()=0
std::vector< Size > startIndexOfConstraint_
std::vector< std::vector< ext::shared_ptr< ConstrainedEvolver > > > constrainedEvolvers_
std::vector< Size > endIndexOfConstraint_
void singleEvolverValues(MarketModelEvolver &evolver, std::vector< Real > &values, bool storeRates=false)
std::valarray< bool > constraintsActive_
std::vector< MarketModelDiscounter > discounters_
Real initialNumeraireValue_
void multiplePathValues(SequenceStatisticsInc &stats, std::vector< std::vector< SequenceStatisticsInc > > &modifiedStats, Size numberOfPaths)
std::vector< std::vector< MarketModelMultiProduct::CashFlow > > cashFlowsGenerated_
std::vector< Size > numberCashFlowsThisStep_
ext::shared_ptr< MarketModelEvolver > originalEvolver_
std::vector< Real > numerairesHeld_
ProxyGreekEngine(ext::shared_ptr< MarketModelEvolver > evolver, std::vector< std::vector< ext::shared_ptr< ConstrainedEvolver > > > constrainedEvolvers, std::vector< std::vector< std::vector< Real > > > diffWeights, std::vector< Size > startIndexOfConstraint, std::vector< Size > endIndexOfConstraint, const Clone< MarketModelMultiProduct > &product, Real initialNumeraireValue)
void singlePathValues(std::vector< Real > &values, std::vector< std::vector< std::vector< Real > > > &modifiedValues)
std::vector< std::vector< std::vector< Real > > > diffWeights_
std::vector< Rate > constraints_
Clone< MarketModelMultiProduct > product_
std::size_t Size
size of a container
std::vector< Size > numberCashFlowsThisStep_
std::vector< std::vector< CashFlow > > cashFlowsGenerated_