use of org.hipparchus.analysis.interpolation.SplineInterpolator in project symja_android_library by axkr.
the class InterpolatingFunction method interpolateSpline.
private double interpolateSpline(RealMatrix matrix, double interpolationX) {
int rowDim = matrix.getRowDimension();
double[] x = new double[rowDim];
double[] y = new double[rowDim];
double[][] data = matrix.getData();
for (int i = 0; i < rowDim; i++) {
x[i] = data[i][0];
y[i] = data[i][1];
}
UnivariateInterpolator interpolator = new SplineInterpolator();
UnivariateFunction function = interpolator.interpolate(x, y);
double interpolatedY = function.value(interpolationX);
return interpolatedY;
}
Aggregations