This class contains the constructor and methods for performing an interpolation within a two dimensional array of data points, y = f(x_{1},x_{2}), using natural cubic splines.
This is a stripped down version of BiCubicSpline in which all the data checking statements and methods have been removed both from this class and from the CubicSplineFast class 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 two 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.
CONSTRUCTOR public BiCubicSplineFast(double[] x1, double[] x2, double[][] y) Usage:
BiCubicSplineFast aa = new BiCubicSplineFast(x1, x2, y);
Creates an instance of the BiCubicSpline object with its internal data arrays initialised to copies of the values in the x1, x2 and y arrays where y is the tabulated function y = f(x_{1},x_{2}). The variables x1 and x2 are are one dimensional arrays of type double and y is a two dimensional array of type double. The y elements are ordered as {{f(x_{1}[0],x_{2}[0], . . . f(x_{1}[0],x_{2}[m-1]} {f(x_{1}[1],x_{2}[0] . . . f(x_{1}[1],x_{2}[m-1]}
......{f(x_{1}[n-1],x_{2}[0], . . . f(x_{1}[n-1],x_{2}[m-1]} } where m is the number of x_{1} values and n is the number of x_{2} values, i.e. 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++){
yValues[i][j] = 'read statement' or 'calculation of f(x1, x2)';
}
}
METHODS
INTERPOLATION public double interpolate(double xx1, double xx2) Usage:
y1 = aa.interpolate(xx1, xx2);
Returns the interpolated value of y, y1, for given values of xx1 and xx2, using 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. This method throws an IllegalArgumentException if xx1 or xx2 is outside the range of the values of x1[] or x2[] supplied to the constructor or if two x1 or x2 values within the y = f(x_{1},x_{2}) data set are identical.