79 {
80 Real factor = isCall ? 1.0 : -1.0;
81
82 Array delta(
deltas_.size(), 0.0);
84
86 Size counter = 0;
88 delta[counter++] = factor * it->second;
89 }
90
92 Size outerIdx = 0;
94 Size innerIdx = 0;
95
96 gamma[outerIdx][outerIdx] = factor *
gammas_.at(std::make_pair(ito->first, ito->first));
97 for (
auto iti =
deltas_.begin(); iti != ito; iti++) {
98 auto it =
gammas_.find(std::make_pair(iti->first, ito->first));
100 gamma[innerIdx][outerIdx] = factor * it->second;
101 gamma[outerIdx][innerIdx] = factor * it->second;
102 }
103 innerIdx++;
104 }
105 outerIdx++;
106 }
107 }
108
116 "ParametricVarCalculator::computeVar(): method MonteCarlo requires mcSamples");
118 "ParametricVarCalculator::computeVar(): method MonteCarlo requires mcSamples");
124 Real res;
125 try {
127 } catch (const std::exception& e) {
128 ALOG(
"Saddlepoint VaR computation exited with an error: " << e.what()
129 << ", falling back on Monte-Carlo");
130 res = QuantExt::deltaGammaVarMc<PseudoRandom>(
omega_, delta, gamma, confidence,
132 }
133 return res;
134 } else
136}
Real deltaGammaVarCornishFisher(const Matrix &omega, const Array &delta, const Matrix &gamma, const Real p, const CovarianceSalvage &sal)
Real deltaGammaVarNormal(const Matrix &omega, const Array &delta, const Matrix &gamma, const Real p, const CovarianceSalvage &sal=NoCovarianceSalvage())
Real deltaVar(const Matrix &omega, const Array &delta, const Real p, const CovarianceSalvage &sal=NoCovarianceSalvage())
Real deltaGammaVarSaddlepoint(const Matrix &omega, const Array &delta, const Matrix &gamma, const Real p, const CovarianceSalvage &sal)