Search in sources :

Example 1 with HermiteInterpolator

use of org.hipparchus.analysis.interpolation.HermiteInterpolator in project symja_android_library by axkr.

the class InterpolatingFunction method interpolate.

private HermiteInterpolator interpolate(IAST matrixAST) {
    HermiteInterpolator interpolator = (HermiteInterpolator) Config.EXPR_CACHE.getIfPresent(matrixAST);
    if (interpolator != null) {
        return interpolator;
    }
    RealMatrix matrix = matrixAST.toRealMatrix();
    if (matrix != null) {
        int rowDim = matrix.getRowDimension();
        int colDim = matrix.getColumnDimension();
        double[] x = new double[colDim - 1];
        double[][] data = matrix.getData();
        interpolator = new HermiteInterpolator();
        for (int i = 0; i < rowDim; i++) {
            System.arraycopy(data[i], 1, x, 0, colDim - 1);
            interpolator.addSamplePoint(data[i][0], x);
        }
        Config.EXPR_CACHE.put(matrixAST, interpolator);
        return interpolator;
    }
    return null;
}
Also used : RealMatrix(org.hipparchus.linear.RealMatrix) HermiteInterpolator(org.hipparchus.analysis.interpolation.HermiteInterpolator)

Aggregations

HermiteInterpolator (org.hipparchus.analysis.interpolation.HermiteInterpolator)1 RealMatrix (org.hipparchus.linear.RealMatrix)1