Class BsInterpolate
- All Implemented Interfaces:
Serializable,Cloneable
Given the data points x = xData, f = yData,
and n the number of elements in
xData and yData, the default action of BsInterpolate computes a cubic
(order = 4) spline interpolant s to the data using a default "not-a-knot" knot sequence.
Constructors are also provided that allow the order and knot sequence to be specified.
This algorithm is based on the routine SPLINT by de Boor (1978, p. 204).
First, the xData vector is sorted and the result is stored in x. The
elements of yData are permuted appropriately and stored in f, yielding the
equivalent data \((x_i, f_i)\) for i = 0 to n-1.
The following preliminary checks are performed on the data, with k = order.
We verify that
\(x_i \lt x_{i+1}\mbox{ for }i=0,\ldots,n-2\)
\({\bf t}_i \lt {\bf t}_{i+k}\mbox{ for }i=0,\ldots,n-1\)
\({\bf t}_i \lt {\bf t}_{i+1}\mbox{ for }i=0,\ldots,n+k-2\)
The first test checks to see that the abscissas are distinct. The second and third inequalities verify that a valid knot sequence has been specified.
In order for the interpolation matrix to be nonsingular, we also check \({\bf t}_{k-1} \leq x_i \leq {\bf t}_n\) for i = 0 to n-1. This first inequality in the last check is necessary since the method used to generate the entries of the interpolation matrix requires that the k possibly nonzero B-splines at \(x_i\), \(B_{j-k+1}, ..., B_j\) where j satisfies \({\bf t}_j \leq x_i \lt {\bf t}_{j+1}\) be well-defined (that is, \(j-k+1 \geq 0\)).
- See Also:
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionBsInterpolate(double[] xData, double[] yData) Constructs a B-spline that interpolates the given data points.BsInterpolate(double[] xData, double[] yData, int order) Constructs a B-spline that interpolates the given data points and order, using a default "not-a-knot" spline knot sequence.BsInterpolate(double[] xData, double[] yData, int order, double[] knot) Constructs a B-spline that interpolates the given data points, using the specified order and knots. -
Method Summary
Methods inherited from class com.imsl.math.BSpline
derivative, derivative, derivative, getKnots, getSpline, integral, value, value
-
Constructor Details
-
BsInterpolate
public BsInterpolate(double[] xData, double[] yData) Constructs a B-spline that interpolates the given data points. The computed B-spline will be order 4 (cubic) and have a default "not-a-knot" spline knot sequence.- Parameters:
xData- Adoublearray containing the x-coordinates of the data. Values must be distinct.yData- Adoublearray containing the y-coordinates of the data. The arrays xData and yData must have the same length.
-
BsInterpolate
public BsInterpolate(double[] xData, double[] yData, int order) Constructs a B-spline that interpolates the given data points and order, using a default "not-a-knot" spline knot sequence.- Parameters:
xData- Adoublearray containing the x-coordinates of the data. Values must be distinct.yData- Adoublearray containing the y-coordinates of the data.The arrays xData and yData must have the same length.order- Anintdenoting the order of the B-spline.
-
BsInterpolate
public BsInterpolate(double[] xData, double[] yData, int order, double[] knot) Constructs a B-spline that interpolates the given data points, using the specified order and knots.- Parameters:
xData- Adoublearray containing the x-coordinates of the data. Values must be distinct.yData- Adoublearray containing the y-coordinates of the data.The arrays xData and yData must have the same length.order- Anintdenoting the order of the spline.knot- Adoublearray containing the knot sequence for the B-spline.
-