@Override public PiecewisePolynomialResultsWithSensitivity interpolateWithSensitivity(double[] xValues, double[] yValues) { ArgChecker.notNull(xValues, "xValues"); ArgChecker.notNull(yValues, "yValues"); ArgChecker.isTrue(xValues.length == yValues.length, "xValues length = yValues length"); PiecewisePolynomialResultsWithSensitivity result; if (_isClamped) { double[][] xyValuesAll = getDataTotal(xValues, yValues); result = _baseMethod.interpolateWithSensitivity(xyValuesAll[0], xyValuesAll[1]); } else { double[] xyValues = getProduct(xValues, yValues); result = _baseMethod.interpolateWithSensitivity(xValues, xyValues); } return (PiecewisePolynomialResultsWithSensitivity) extrapolateByLinearFunction(result, xValues); }
@Override public PiecewisePolynomialResultsWithSensitivity interpolateWithSensitivity(double[] xValues, double[] yValues) { ArgChecker.notNull(xValues, "xValues"); ArgChecker.notNull(yValues, "yValues"); ArgChecker.isTrue(xValues.length == yValues.length, "xValues length = yValues length"); double[][] xyValuesAll = getDataTotal(xValues, yValues); return _baseMethod.interpolateWithSensitivity(xyValuesAll[0], xyValuesAll[1]); }
public void testInterpolateWithSensitivity() { for (PiecewisePolynomialInterpolator baseInterp : BASE_INTERP) { ClampedPiecewisePolynomialInterpolator interp = new ClampedPiecewisePolynomialInterpolator(baseInterp, X_CLAMPED, Y_CLAMPED); PiecewisePolynomialResultsWithSensitivity computed = interp.interpolateWithSensitivity(X_VALUES, Y_VALUES); PiecewisePolynomialResultsWithSensitivity expected = baseInterp.interpolateWithSensitivity(X_VALUES_TOTAL, Y_VALUES_TOTAL); assertEquals(computed, expected); } }
Bound(DoubleArray xValues, DoubleArray yValues) { super(xValues, yValues); this.xValues = xValues.toArrayUnsafe(); this.yValues = yValues.toArrayUnsafe(); PiecewisePolynomialInterpolator underlying = new NaturalSplineInterpolator(); this.poly = underlying.interpolate(xValues.toArray(), yValues.toArray()); this.polySens = Suppliers.memoize(() -> underlying.interpolateWithSensitivity(xValues.toArray(), yValues.toArray())); }
Bound(DoubleArray xValues, DoubleArray yValues) { super(xValues, yValues); this.xValues = xValues.toArrayUnsafe(); this.yValues = yValues.toArrayUnsafe(); this.logYValues = getYLogValues(this.yValues); PiecewisePolynomialInterpolator underlying = new MonotonicityPreservingCubicSplineInterpolator(new LogNaturalSplineHelper()); this.poly = underlying.interpolate(xValues.toArray(), logYValues); this.polySens = Suppliers.memoize(() -> underlying.interpolateWithSensitivity(xValues.toArray(), logYValues)); }
Bound(DoubleArray xValues, DoubleArray yValues) { super(xValues, yValues); this.xValues = xValues.toArrayUnsafe(); this.yValues = yValues.toArrayUnsafe(); PiecewisePolynomialInterpolator underlying = new NonnegativityPreservingCubicSplineInterpolator(new NaturalSplineInterpolator()); this.poly = underlying.interpolate(xValues.toArray(), yValues.toArray()); this.polySens = Suppliers.memoize(() -> underlying.interpolateWithSensitivity(xValues.toArray(), yValues.toArray())); }
Bound(DoubleArray xValues, DoubleArray yValues) { super(xValues, yValues); this.xValues = xValues.toArrayUnsafe(); this.yValues = yValues.toArrayUnsafe(); PiecewisePolynomialInterpolator underlying = new PiecewiseCubicHermiteSplineInterpolatorWithSensitivity(); PiecewisePolynomialResult poly = underlying.interpolate(xValues.toArray(), yValues.toArray()); this.knots = poly.getKnots(); this.coefMatrix = poly.getCoefMatrix(); this.coefMatrixSensi = Suppliers.memoize( () -> underlying.interpolateWithSensitivity(xValues.toArray(), yValues.toArray()).getCoefficientSensitivityAll()); }
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);
Bound(DoubleArray xValues, DoubleArray yValues) { super(xValues, yValues); ArgChecker.isTrue(xValues.get(0) > 0d || xValues.get(xValues.size() - 1) < 0d, "xValues must have the same sign"); this.xValues = xValues.toArrayUnsafe(); this.yValues = yValues.toArrayUnsafe(); PiecewisePolynomialInterpolator underlying = new MonotonicityPreservingCubicSplineInterpolator(new LogNaturalSplineHelper()); this.poly = underlying.interpolate(xValues.toArray(), getProduct(this.xValues, this.yValues)); this.polySens = Suppliers.memoize( () -> underlying.interpolateWithSensitivity(xValues.toArray(), getProduct(this.xValues, this.yValues))); }
PiecewisePolynomialResultsWithSensitivity result = interps[k].interpolateWithSensitivity(xValues, yValues); for (int j = 0; j < nData; ++j) { yValuesUp[j] = yValues[j] * (1. + EPS); yValuesDw[j] = yValues[j] * (1. - EPS); final PiecewisePolynomialResultsWithSensitivity resultUp = interps[k].interpolateWithSensitivity(xValues, yValuesUp); final PiecewisePolynomialResultsWithSensitivity resultDw = interps[k].interpolateWithSensitivity(xValues, yValuesDw);
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);
PiecewisePolynomialResultsWithSensitivity result = interps[k].interpolateWithSensitivity(xValues, yValues); for (int j = 0; j < nData; ++j) { yValuesUp[j] = yValues[j] * (1. + EPS); yValuesDw[j] = yValues[j] * (1. - EPS); final PiecewisePolynomialResultsWithSensitivity resultUp = interps[k].interpolateWithSensitivity(xValues, yValuesUp); final PiecewisePolynomialResultsWithSensitivity resultDw = interps[k].interpolateWithSensitivity(xValues, yValuesDw);
final PiecewisePolynomialResultsWithSensitivity resultWithSensitivity = _method.interpolateWithSensitivity(xValues, yValues);
final PiecewisePolynomialResultsWithSensitivity resultWithSensitivity = _method.interpolateWithSensitivity(xValues, yValues); ArgChecker.isTrue(resultWithSensitivity.getOrder() == 4, "Primary interpolant is not cubic");
xValuesClamped, yValuesClamped); PiecewisePolynomialResultsWithSensitivity result = interp.interpolateWithSensitivity(xValues, yValues); PiecewisePolynomialResultsWithSensitivity resultBase = INTERP_SENSE[i].interpolateWithSensitivity( xValuesForBase, xyValuesBase); for (int j = 0; j < nKeys; ++j) {
ProductPiecewisePolynomialInterpolator interp = new ProductPiecewisePolynomialInterpolator(INTERP_SENSE[i]); PiecewisePolynomialResultsWithSensitivity result = interp.interpolateWithSensitivity(xValues, yValues); PiecewisePolynomialResultsWithSensitivity resultBase = INTERP_SENSE[i].interpolateWithSensitivity(xValues, xyValues); for (int j = 0; j < nKeys; ++j) {
BoundCurveInterpolator bound = INTERP.bind(xValues, yValues); PiecewisePolynomialResultsWithSensitivity ppRes = BASE_INTERP.interpolateWithSensitivity(xValues.toArray(), pValues.toArray()); Function<Double, Double> funcDeriv = x -> bound.interpolate(x); for (int i = 0; i < nKeys; ++i) {
BoundCurveInterpolator bound = INTERP.bind(xValues, yValues); PiecewisePolynomialResultsWithSensitivity ppRes = BASE_INTERP.interpolateWithSensitivity(xValues.toArray(), pValues.toArray()); Function<Double, Double> funcDeriv = x -> bound.interpolate(x); for (int i = 0; i < nKeys; ++i) {
BoundCurveInterpolator bound = INTERP.bind(xValues, yValues); PiecewisePolynomialResultsWithSensitivity ppRes = BASE_INTERP.interpolateWithSensitivity(xValues.toArray(), pValues.toArray()); Function<Double, Double> funcDeriv = x -> bound.interpolate(x); for (int i = 0; i < nKeys; ++i) {