FunctionalDoublesCurve extends DoublesCurve { public InterpolatedDoublesCurve toInterpolatedDoublesCurve(final double[] x, final Interpolator1D interpolator) { Validate.notNull(x, "x"); Validate.notNull(interpolator); final int n = x.length; final double[] y = new double[n]; for (int i = 0; i < n; i++) { y[i] = _function.evaluate(x[i]); } return InterpolatedDoublesCurve.from(x, y, interpolator); } protected  FunctionalDoublesCurve();  FunctionalDoublesCurve(final Function1D<Double, Double> function); private  FunctionalDoublesCurve(final Function1D<Double, Double> function, final Function1D<Double, Double> derivative);  FunctionalDoublesCurve(final Function1D<Double, Double> function, final String name); private  FunctionalDoublesCurve(final Function1D<Double, Double> function, final Function1D<Double, Double> derivative, final String name); static FunctionalDoublesCurve from(final Function1D<Double, Double> function); static FunctionalDoublesCurve from(final Function1D<Double, Double> function, final Function1D<Double, Double> derivative); static FunctionalDoublesCurve from(final Function1D<Double, Double> function, final String name); static FunctionalDoublesCurve from(final Function1D<Double, Double> function, final Function1D<Double, Double> derivative, final String name); @Override Double[] getXData(); @Override Double[] getYData(); @Override Double getYValue(final Double x); @Override double getDyDx(final double x); @Override Double[] getYValueParameterSensitivity(final Double x); @Override int size(); InterpolatedDoublesCurve toInterpolatedDoublesCurve(final double[] x, final Interpolator1D interpolator); Function1D<Double, Double> getFunction(); Function1D<Double, Double> getFirstDerivativeFunction(); @Override boolean equals(final Object obj); @Override int hashCode(); static FunctionalDoublesCurve.Meta meta(); @Override FunctionalDoublesCurve.Meta metaBean(); final Property<Function1D<Double, Double>> function(); final Property<Function1D<Double, Double>> derivative(); @Override FunctionalDoublesCurve clone(); @Override String toString();  }
@Test public void testConvert() { final double eps = 1e-15; final double[] x = new double[] {0, 1, 2}; final LinearInterpolator1D interpolator = new LinearInterpolator1D(); InterpolatedDoublesCurve other = CURVE.toInterpolatedDoublesCurve(x, interpolator); assertArrayEquals(other.getXDataAsPrimitive(), x, eps); assertArrayEquals(other.getYDataAsPrimitive(), new double[] {F.evaluate(x[0]), F.evaluate(x[1]), F.evaluate(x[2])}, eps); }