final double maxT = expiries[n - 1];
final double maxProxyDelta = 0.4;
final PDEFullResults1D pdeRes = runForwardPDESolver(_localVolatilityMoneyness, _isCall, _theta, maxT, maxProxyDelta,
_timeSteps, _spaceSteps, _timeGridBunching, _spaceGridBunching, 1.0);
final BlackVolatilitySurfaceMoneyness pdeVolSurface = modifiedPriceToVolSurface(_marketData.getForwardCurve(), pdeRes, 0, maxT, 0.3, 3.0, _isCall);
double chiSq = 0;
for (int i = 0; i < n; i++) {
final int m = strikes[i].length;
final double t = expiries[i];
for (int j = 0; j < m; j++) {
final double k = strikes[i][j];
final double mrtVol = vols[i][j];
final double modelVol = pdeVolSurface.getVolatility(t, k);
ps.println(expiries[i] + "\t" + k + "\t" + mrtVol + "\t" + modelVol);
chiSq += (mrtVol - modelVol) * (mrtVol - modelVol);
}
}
ps.println("chi^2 " + chiSq * 1e6);
ps.print("\n");
ps.println("strike sensitivity");
for (int i = 0; i < n; i++) {
ps.print(expiries[i] + "\t" + "" + "\t");
}
ps.print("\n");
for (int i = 0; i < n; i++) {
ps.print("Strike\tImplied Vol\t");
}
ps.print("\n");
for (int j = 0; j < 100; j++) {
for (int i = 0; i < n; i++) {
final int m = strikes[i].length;
final double t = expiries[i];
final double kLow = strikes[i][0];
final double kHigh = strikes[i][m - 1];
final double k = kLow + (kHigh - kLow) * j / 99.;
ps.print(k + "\t" + pdeVolSurface.getVolatility(t, k) + "\t");
}
ps.print("\n");
}
}