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

public Class BicubicInterpolatingFunction

Additional top-level class in compilation unit: BicubicFunction.

extends Object
implements BivariateFunction
Class Inheritance
All Implemented Interfaces
org.apache.commons.math3.analysis.BivariateFunction
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

Function that implements the bicubic spline interpolation.
Since
3.4

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 BicubicFunction[][]
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
BicubicInterpolatingFunction(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
)

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 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.

splinesback to summary
private final BicubicFunction[][] 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

BicubicInterpolatingFunctionback to summary
public BicubicInterpolatingFunction(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.

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.

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.