This class contains the constructor and method for performing a multi-dimensional cubic spline interpolation, i.e. an interpolation within a n-dimensional array of data points, y = f(x_{1},x_{2},x_{3} . . . x_{n}), using a natural cubic splines and where n may take any integer value. The interpolation procedure is recursive.
This is a stripped down version of PolyCubicSpline in which all the data checking statements and methods have been removed both from this class and from the BiCubicSplineFast and CubicSplineFast classes which it calls. This removal allows a faster execution time. The decrease in execution time may be significant if repeated interpolation within very large data arrays is required. However the user must ensure that all the multi-dimensional data arrays x-values are in ascending order, that there are adequate numbers of data points and that the x-values of the point for which an interpolated y-value is required lie within the bounds of the supplied data.
If the number of dimension, n, of the data array, y = f(x_{1},x_{2},x_{3} . . . x_{n}), is less than three you may find CubicSplineFast [n = 1] and BiCubicSplineFast [n = 2] more convenient and these classes are slightly more efficient.
CONSTRUCTOR public PolyCubicSplineFast(Object xValues, Object yValues) Usage:
PolyCubicSplineFast aa = new PolyCubicSplineFast(xValues, yValues);
Creates an instance of the PolyCubicSplineFast object with its internal data arrays initialised the values in xValues and yValues containing the tabulated data for the arrays x_{1},x_{2},x_{3} . . . x_{n} and for y = f(x_{1},x_{2},x_{3} . . . x_{n}).
The argument xValues is a two dimensional array of doubles in which xValues[0] is the array of x_{1} values, i.e. {xValue[0][0] to xValue[0][p-1]}, xValues[1] is the array of x_{2} values i.e. {xValue[1][0] to xValue[1][q-1]}, . . . and xValues[n-1] is the array of x_{n} i.e. {xValue[n-1][0] to xValue[n-1][r-1]} where there are p values x_{1}, q values of x_{2}, ..... r values of x_{n}.
The argument yValues is an n-dimensional array of doubles containing the tabulated values of y = f(x_{1},x_{2},x_{3} . . . x_{n}). The yValues elements are ordered as in the order of the following nested for loops if you were reading in or calculating the tabulated data: for(int i=0; i<x1.length; i++){ for(int j=0; j<x2.length; j++){ for(int k=0; k<x3.length; k++){ for(int l=0; l<x4.length; l++){ for(int m=0; m<x5.length; m++){
yValues[i][j][k][l][m] = 'read statement' or 'calculation of f(x1, x2, x3, x4, x5)';
}
}
}
}
}
METHODS
INTERPOLATION public double interpolate(double[] xCoordinates) Usage:
y1 = aa.interpolate(xx);
Returns the interpolated value of y, y1, for n given values of x_{1}, x_{2}, x_{3} . . . x_{n}, entered as the two dimensional array, xx, using the y = f(x_{1},x_{2},x_{3} . . . x_{n}) data entered via the constructor. This method may be called as often as required. The interpolation procedure is recursive. g the y = f(x_{1},x_{2}) data entered via the constructor. This method may be called as often as required. The inner second derivatives needed for the interpolation are calculated and stored on instantiation so that they need not be recalculated on each call to this method.