final double xMax = xValues[nData - 1];
for (int i = 0; i < 10 * nData; ++i) {
xKeys[i] = xMin + (xMax - xMin) / (10 * nData - 1) * i;
}
PiecewisePolynomialResultsWithSensitivity result = interps[k].interpolateWithSensitivity(xValues, yValues);
for (int j = 0; j < nData; ++j) {
yValuesUp[j + 1] = yValues[j + 1] * (1. + EPS);
yValuesDw[j + 1] = yValues[j + 1] * (1. - EPS);
final PiecewisePolynomialResultsWithSensitivity resultUp = interps[k].interpolateWithSensitivity(xValues, yValuesUp);
final PiecewisePolynomialResultsWithSensitivity resultDw = interps[k].interpolateWithSensitivity(xValues, yValuesDw);
final double[] valuesUp = FUNCTION.evaluate(resultUp, xKeys).getData()[0];
final double[] valuesDw = FUNCTION.evaluate(resultDw, xKeys).getData()[0];
final double[] diffUp = FUNCTION.differentiate(resultUp, xKeys).getData()[0];
final double[] diffDw = FUNCTION.differentiate(resultDw, xKeys).getData()[0];