* @param g2Data The G2++ data (curves and G2++ parameters).
* @return The present value.
*/
public MultipleCurrencyAmount presentValue(final InstrumentDerivative instrument, final Currency ccy, final G2ppProviderInterface g2Data) {
MulticurveProviderInterface multicurves = g2Data.getMulticurveProvider();
G2ppPiecewiseConstantParameters parameters = g2Data.getG2ppParameters();
final DecisionSchedule decision = instrument.accept(DC, multicurves);
final double[] decisionTime = decision.getDecisionTime();
final double[][] impactTime = decision.getImpactTime();
final int nbJump = decisionTime.length;
final double numeraireTime = decisionTime[nbJump - 1];
final double pDN = multicurves.getDiscountFactor(ccy, numeraireTime);
// Discount factor to numeraire date for rebasing.
final double[][] pDI = new double[nbJump][];
// Initial discount factors to each impact date.
for (int loopjump = 0; loopjump < nbJump; loopjump++) {
pDI[loopjump] = new double[impactTime[loopjump].length];
for (int i = 0; i < impactTime[loopjump].length; i++) {
pDI[loopjump][i] = multicurves.getDiscountFactor(ccy, impactTime[loopjump][i]) / pDN;
}
}
final double rhog2pp = parameters.getCorrelation();
final double[][][] h = MODEL.volatilityMaturityPart(parameters, numeraireTime, impactTime); // factor/jump/cf
final double[][][] gamma = new double[nbJump][2][2]; // jump/factor/factor
final double[][] cov = new double[2 * nbJump][2 * nbJump]; // factor 0 - factor 1
for (int loopjump = 0; loopjump < nbJump; loopjump++) {
gamma[loopjump] = MODEL.gamma(parameters, 0.0, decisionTime[loopjump]);