IMSL C# Numerical Library

Spline2DInterpolate Class

Computes a two-dimensional, tensor-product spline interpolant from two-dimensional, tensor-product data.

For a list of all members of this type, see Spline2DInterpolate Members.

System.Object
   Imsl.Math.Spline2D
      Imsl.Math.Spline2DInterpolate

public class Spline2DInterpolate : Spline2D

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Remarks

The class Spline2DInterpolate computes a tensor-product spline interpolant. The tensor-product spline interpolant to data \{(x_i, y_j, f_{ij})\}, where 0 \le i \le (n_x - 1) and 0 \le j \le (n_y - 1) has the form

\sum_{m=0}^{n_y - 1} \sum_{n=0}^{n_x-1} c_{nm}B_{n,k_x,t_x}(x) B_{m,k_y,t_y}(y)
where k_x and k_y are the orders of the splines. These numbers are defaulted to be 4, but can be set to any positive integer using xOrder and yOrder in the constructor. Likewise, t_x and t_y are the corresponding knot sequences (xKnots and yKnots). These default values are selected by Spline2DInterpolate. The algorithm requires that
t_x(k_x - 1) \le x_i \le t_x(n_x)\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,0 \le i \le n_x -1
t_y(k_y - 1) \le y_j \le t_y(n_y - 1)\,\,\,\,\,\,\,\,\,\,\,0 \le j \le n_y -1
Tensor-product spline interpolants in two dimensions can be computed quite efficiently by solving (repeatedly) two univariate interpolation problems.

The computation is motivated by the following observations. It is necessary to solve the system of equations

\sum_{m=0}^{n_y - 1} \sum_{n=0}^{n_x-1} c_{nm}B_{n,k_x,t_x}(x_i) B_{m,k_y,t_y}(y_j) = f_{ij}
Setting
h_{mi} = \sum_{n=0}^{n_x-1} c_{nm}B_{n,k_x,t_x}(x_i)
note that for each fixed i from 0 to n_x - 1, we have n_y linear equations in the same number of unknowns as can be seen below:
\sum_{m=0}^{n_y - 1} h_{mi}B_{n,k_y,t_y}(y_j) = f_{ij}
\sum_{m=0}^{n_y - 1} \sum_{n=0}^{n_x-1} c_{nm}B_{n,k_x,t_x}(x_i) B_{m,k_y,t_y}(y_j) = f_{ij}
Setting
h_{mi} = \sum_{n=0}^{n_x-1} c_{nm}B_{n,k_x,t_x}(x_i)
note that for each fixed i from 0 to n_x - 1, we have n_y - 1 linear equations in the same number of unknowns as can be seen below:
\sum_{m=0}^{n_y - 1} h_{mi}B_{m,k_y,t_y}(y_j) = f_{ij}
The same matrix appears in all of the equations above:
\bigl[ B_{m,k_y,t_y}(y_j)\bigr]\,\,\,\,\,\,\,\,\,\,\, 0 \le m,j \le n_y - 1
Thus, only factor this matrix once and then apply this factorization to the n_x right-hand sides. Once this is done and h_{mi} is computed, then solve for the coefficients c_{nm} using the relation
\sum_{n=0}^{n_x-1} c_{nm}B_{n,k_x,t_x}(x_i) = h_{mi}
for n from 0 to n_y - 1, which again involves one factorization and n_y solutions to the different right-hand sides. The class Spline2DInterpolate is based on the routine SPLI2D by de Boor (1978, p. 347).

Requirements

Namespace: Imsl.Math

Assembly: ImslCS (in ImslCS.dll)

See Also

Spline2DInterpolate Members | Imsl.Math Namespace | Example 1 | Example 2 | Example 3