Top Description Fields Constructors Methods
org.apache.commons.math3.analysis.interpolation

public Class BicubicSplineInterpolatingFunction

Additional top-level class in compilation unit: BicubicSplineFunction.

extends Object
implements BivariateFunction
Class Inheritance
All Implemented Interfaces
org.apache.commons.math3.analysis.BivariateFunction
Annotations
@Deprecated
Imports
java.util.Arrays, org.apache.commons.math3.analysis.BivariateFunction, org.apache.commons.math3.exception.DimensionMismatchException, .NoDataException, .OutOfRangeException, .NonMonotonicSequenceException, org.apache.commons.math3.util.MathArrays

Deprecated

as of 3.4 replaced by org.apache.commons.math3.analysis.interpolation.PiecewiseBicubicSplineInterpolatingFunction

Function that implements the bicubic spline interpolation. Due to numerical accuracy issues this should not be used.
Since
2.1

Field Summary

Modifier and TypeField and Description
private static final double[][]
AINV

Matrix to compute the spline coefficients from the function values and function derivatives values

private static final int
NUM_COEFF

Number of coefficients.

private final BivariateFunction[][][]
partialDerivatives

Partial derivatives.

private final BicubicSplineFunction[][]
splines

Set of cubic splines patching the whole data grid

private final double[]
xval

Samples x-coordinates

private final double[]
yval

Samples y-coordinates

Constructor Summary

AccessConstructor and Description
public
BicubicSplineInterpolatingFunction(double[]
Sample values of the x-coordinate, in increasing order.
x
,
double[]
Sample values of the y-coordinate, in increasing order.
y
,
double[][]
Values of the function on every grid point.
f
,
double[][]
Values of the partial derivative of function with respect to x on every grid point.
dFdX
,
double[][]
Values of the partial derivative of function with respect to y on every grid point.
dFdY
,
double[][]
Values of the cross partial derivative of function on every grid point.
d2FdXdY
)

public
BicubicSplineInterpolatingFunction(double[]
Sample values of the x-coordinate, in increasing order.
x
,
double[]
Sample values of the y-coordinate, in increasing order.
y
,
double[][]
Values of the function on every grid point.
f
,
double[][]
Values of the partial derivative of function with respect to x on every grid point.
dFdX
,
double[][]
Values of the partial derivative of function with respect to y on every grid point.
dFdY
,
double[][]
Values of the cross partial derivative of function on every grid point.
d2FdXdY
,
boolean
Whether to initialize the internal data needed for calling any of the methods that compute the partial derivatives this function.
initializeDerivatives
)

Method Summary

Modifier and TypeMethod and Description
private double[]

Returns:

the spline coefficients.
computeSplineCoefficients
(double[]
List of function values and function partial derivatives values.
beta
)

Compute the spline coefficients from the list of function values and function partial derivatives values at the four corners of a grid element.

public boolean

Returns:

true if (x, y) is a valid point.
isValidPoint
(double
First coordinate.
x
,
double
Second coordinate.
y
)

Indicates whether a point is within the interpolation range.

private double

Returns:

the value at point (x, y) of the selected partial derivative.
partialDerivative
(int
First index in partialDerivatives.
which
,
double
x-coordinate.
x
,
double
y-coordinate.
y
)

public double

Returns:

the value at point (x, y) of the first partial derivative with respect to x.
partialDerivativeX
(double
x-coordinate.
x
,
double
y-coordinate.
y
)

public double

Returns:

the value at point (x, y) of the second partial derivative with respect to x.
partialDerivativeXX
(double
x-coordinate.
x
,
double
y-coordinate.
y
)

public double

Returns:

the value at point (x, y) of the second partial cross-derivative.
partialDerivativeXY
(double
x-coordinate.
x
,
double
y-coordinate.
y
)

public double

Returns:

the value at point (x, y) of the first partial derivative with respect to y.
partialDerivativeY
(double
x-coordinate.
x
,
double
y-coordinate.
y
)

public double

Returns:

the value at point (x, y) of the second partial derivative with respect to y.
partialDerivativeYY
(double
x-coordinate.
x
,
double
y-coordinate.
y
)

private int

Returns:

the index in val corresponding to the interval containing c.
searchIndex
(double
Coordinate.
c
,
double[]
Coordinate samples.
val
)

public double
value(double
Abscissa for which the function value should be computed.
x
,
double
Ordinate for which the function value should be computed.
y
)

Implements org.apache.commons.math3.analysis.BivariateFunction.value.

Compute the value for the function.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

AINVback to summary
private static final double[][] AINV

Matrix to compute the spline coefficients from the function values and function derivatives values

NUM_COEFFback to summary
private static final int NUM_COEFF

Number of coefficients.

partialDerivativesback to summary
private final BivariateFunction[][][] partialDerivatives

Partial derivatives. The value of the first index determines the kind of derivatives: 0 = first partial derivatives wrt x 1 = first partial derivatives wrt y 2 = second partial derivatives wrt x 3 = second partial derivatives wrt y 4 = cross partial derivatives

splinesback to summary
private final BicubicSplineFunction[][] splines

Set of cubic splines patching the whole data grid

xvalback to summary
private final double[] xval

Samples x-coordinates

yvalback to summary
private final double[] yval

Samples y-coordinates

Constructor Detail

BicubicSplineInterpolatingFunctionback to summary
public BicubicSplineInterpolatingFunction(double[] x, double[] y, double[][] f, double[][] dFdX, double[][] dFdY, double[][] d2FdXdY) throws DimensionMismatchException, NoDataException, NonMonotonicSequenceException
Parameters
x:double[]

Sample values of the x-coordinate, in increasing order.

y:double[]

Sample values of the y-coordinate, in increasing order.

f:double[][]

Values of the function on every grid point.

dFdX:double[][]

Values of the partial derivative of function with respect to x on every grid point.

dFdY:double[][]

Values of the partial derivative of function with respect to y on every grid point.

d2FdXdY:double[][]

Values of the cross partial derivative of function on every grid point.

Exceptions
DimensionMismatchException:
if the various arrays do not contain the expected number of elements.
NoDataException:
if any of the arrays has zero length.
NonMonotonicSequenceException:
if x or y are not strictly increasing.
BicubicSplineInterpolatingFunctionback to summary
public BicubicSplineInterpolatingFunction(double[] x, double[] y, double[][] f, double[][] dFdX, double[][] dFdY, double[][] d2FdXdY, boolean initializeDerivatives) throws DimensionMismatchException, NoDataException, NonMonotonicSequenceException
Parameters
x:double[]

Sample values of the x-coordinate, in increasing order.

y:double[]

Sample values of the y-coordinate, in increasing order.

f:double[][]

Values of the function on every grid point.

dFdX:double[][]

Values of the partial derivative of function with respect to x on every grid point.

dFdY:double[][]

Values of the partial derivative of function with respect to y on every grid point.

d2FdXdY:double[][]

Values of the cross partial derivative of function on every grid point.

initializeDerivatives:boolean

Whether to initialize the internal data needed for calling any of the methods that compute the partial derivatives this function.

Exceptions
DimensionMismatchException:
if the various arrays do not contain the expected number of elements.
NoDataException:
if any of the arrays has zero length.
NonMonotonicSequenceException:
if x or y are not strictly increasing.
See Also
partialDerivativeX(double, double), partialDerivativeY(double, double), partialDerivativeXX(double, double), partialDerivativeYY(double, double), partialDerivativeXY(double, double)

Method Detail

computeSplineCoefficientsback to summary
private double[] computeSplineCoefficients(double[] beta)

Compute the spline coefficients from the list of function values and function partial derivatives values at the four corners of a grid element. They must be specified in the following order:

  • f(0,0)
  • f(1,0)
  • f(0,1)
  • f(1,1)
  • fx(0,0)
  • fx(1,0)
  • fx(0,1)
  • fx(1,1)
  • fy(0,0)
  • fy(1,0)
  • fy(0,1)
  • fy(1,1)
  • fxy(0,0)
  • fxy(1,0)
  • fxy(0,1)
  • fxy(1,1)
where the subscripts indicate the partial derivative with respect to the corresponding variable(s).
Parameters
beta:double[]

List of function values and function partial derivatives values.

Returns:double[]

the spline coefficients.

isValidPointback to summary
public boolean isValidPoint(double x, double y)

Indicates whether a point is within the interpolation range.

Parameters
x:double

First coordinate.

y:double

Second coordinate.

Returns:boolean

true if (x, y) is a valid point.

Since
3.3
partialDerivativeback to summary
private double partialDerivative(int which, double x, double y) throws OutOfRangeException
Parameters
which:int

First index in partialDerivatives.

x:double

x-coordinate.

y:double

y-coordinate.

Returns:double

the value at point (x, y) of the selected partial derivative.

Exceptions
OutOfRangeException:
if x (resp. y) is outside the range defined by the boundary values of xval (resp. yval).
NullPointerException:
if the internal data were not initialized (cf. constructor).
partialDerivativeXback to summary
public double partialDerivativeX(double x, double y) throws OutOfRangeException
Parameters
x:double

x-coordinate.

y:double

y-coordinate.

Returns:double

the value at point (x, y) of the first partial derivative with respect to x.

Exceptions
OutOfRangeException:
if x (resp. y) is outside the range defined by the boundary values of xval (resp. yval).
NullPointerException:
if the internal data were not initialized (cf. constructor).
partialDerivativeXXback to summary
public double partialDerivativeXX(double x, double y) throws OutOfRangeException
Parameters
x:double

x-coordinate.

y:double

y-coordinate.

Returns:double

the value at point (x, y) of the second partial derivative with respect to x.

Exceptions
OutOfRangeException:
if x (resp. y) is outside the range defined by the boundary values of xval (resp. yval).
NullPointerException:
if the internal data were not initialized (cf. constructor).
partialDerivativeXYback to summary
public double partialDerivativeXY(double x, double y) throws OutOfRangeException
Parameters
x:double

x-coordinate.

y:double

y-coordinate.

Returns:double

the value at point (x, y) of the second partial cross-derivative.

Exceptions
OutOfRangeException:
if x (resp. y) is outside the range defined by the boundary values of xval (resp. yval).
NullPointerException:
if the internal data were not initialized (cf. constructor).
partialDerivativeYback to summary
public double partialDerivativeY(double x, double y) throws OutOfRangeException
Parameters
x:double

x-coordinate.

y:double

y-coordinate.

Returns:double

the value at point (x, y) of the first partial derivative with respect to y.

Exceptions
OutOfRangeException:
if x (resp. y) is outside the range defined by the boundary values of xval (resp. yval).
NullPointerException:
if the internal data were not initialized (cf. constructor).
partialDerivativeYYback to summary
public double partialDerivativeYY(double x, double y) throws OutOfRangeException
Parameters
x:double

x-coordinate.

y:double

y-coordinate.

Returns:double

the value at point (x, y) of the second partial derivative with respect to y.

Exceptions
OutOfRangeException:
if x (resp. y) is outside the range defined by the boundary values of xval (resp. yval).
NullPointerException:
if the internal data were not initialized (cf. constructor).
searchIndexback to summary
private int searchIndex(double c, double[] val)
Parameters
c:double

Coordinate.

val:double[]

Coordinate samples.

Returns:int

the index in val corresponding to the interval containing c.

Exceptions
OutOfRangeException:
if c is out of the range defined by the boundary values of val.
valueback to summary
public double value(double x, double y) throws OutOfRangeException

Implements org.apache.commons.math3.analysis.BivariateFunction.value.

Doc from org.apache.commons.math3.analysis.BivariateFunction.value.

Compute the value for the function.

Parameters
x:double

Abscissa for which the function value should be computed.

y:double

Ordinate for which the function value should be computed.

Returns:double

the value.