ILNumerics Ultimate VS

Interpolationsplinen Method (InArraySingle, NullableSingle, InCell, InCell)

ILNumerics Ultimate VS Documentation
ILNumerics - Technical Application Development
N-dimensional gridded cubic spline interpolation from sampled grids.

[ILNumerics Interpolation Toolbox]

Namespace:  ILNumerics.Toolboxes
Assembly:  ILNumerics.Toolboxes.Interpolation (in ILNumerics.Toolboxes.Interpolation.dll) Version: 5.5.0.0 (5.5.7503.3146)
Syntax

public static RetArray<float> splinen(
	InArray<float> V,
	Nullable<float> outofRangeValues,
	InCell X = null,
	InCell Xn = null
)

Parameters

V
Type: ILNumericsInArraySingle
Sampled values, N-dimensional array, at least 4 elements in each dimension are required.
outofRangeValues
Type: SystemNullableSingle
Scalar value for all result elements which lay outside of the sample range (X). Null: extrapolate.
X (Optional)
Type: ILNumericsInCell
[Optional] Sample grid position vectors (non-/uniform) for the axes of V. Cell array of lenght N. Default: (null) auto spacing from 0, step 1.
Xn (Optional)
Type: ILNumericsInCell
[Optional] Interpolation grid vectors (non-/uniform). Cell array of length N. Default (null): create query grid by refining X once.

Return Value

Type: RetArraySingle
Spline interpolated values according to the n-dimensional range given in Xn.
Exceptions

ExceptionCondition
ArgumentExceptionif V has less than 4 elements in any dimension or any range in X does not match the corresponding dimension length in V.
ArgumentNullException if on entry any of V or X are null.
Remarks

splinen(InArraySingle, NullableSingle, InCell, InCell) performs efficient piecewise cubic interpolation on a n-dimensional regular grid of sampled values V. X is expected as a cell vector with [V.S.NumberOfDimensions] arrays as cell elements. Each element is a numeric array (preferred: ArrayT corresponding to element type of V) with the strictly monotonically increasing range specification for the corresponding dimension in V. The spacing between elements within each dimension must not be uniform.

The spline interpolation function created by splinen(InArraySingle, NullableSingle, InCell, InCell) will always match the given data values V at the specified sample positions Xn.

New values to be interpolated are specified by the grid vectors Xn. Individual arrays in the cell Xn form a grid of the same dimensionality as V. Therefore and similarily to X, the grid of new values is always regular but not necessarily uniform.

Any range for V not provided in X (i.e. X_i is null or empty) is automatically replaced by an upwards counting vector: counter(0,1,size(l,1)), where l=V.S[i]. If the parameter X is null on entry, the same scheme applies to all dimensions of V.

If Xn is not provided (i.e.: is null) or for any cell element in Xn being not provided for the corresponding dimension in V, the ranges for the new values in the corresponding dimension to be returned are computed by refining the existing range from X. Every grid cell determined by X is therefore split into half, roughly doubling the resolution for the resulting range.

Any of X and Xn inputs are allowed to provide not only vectors but n-dimensional arrays as the result of functions like meshgrid(InArraySingle, InArraySingle, InArraySingle, OutArraySingle, OutArraySingle). In this case, only the first 'vector' along each corresponding dimension is considered from the input arrays. If, for example, a matrix is given for the first cell element in X the first column is extracted and its values are assumed for the ranges of the first dimension in V.

Algorithm for uniform V: splinen(InArraySingle, NullableSingle, InCell, InCell) for uniform data V (as specified by X) implements standard Catmull-Rom splines by scaling the axis ranges given by X to the unit interval [0,1] and applying the new positions to the surrounding two hypercubes in each dimension of V. The algorithm is optimized for large data V and fine Xn grids. Fastest results are obtained when many new query points are to be computed per hypercube in V and if these points are arranged along the first dimension of V. I.e: when a significant large range was provided in Xn[0].

The algorithm is parallelized for multicore systems. The implementation commonly outperforms competitive algorithms of similar CAS by factors.

On non-uniform data V the new query points are computed by efficient, subsequent one-dimensional spline interpolations via spline(InArraySingle, InArraySingle, InArraySingle, InArraySingle, InArraySingle).

Support for NaN values: spline interpolation performs interpolation by taking all values of V into account. What enables best smoothness properties on the other hand implies that any NaN value in V populate to all elements of the output. Therefore, one must ensure that no NaN values exist in V. Use cubic polynomial interpolation in interpn(InArraySingle, InCell, InCell, InterpolationMethod) for an alternative on data with NaN values.

This n-dimensional spline interpolation is called from interpn(InArraySingle, NullableSingle, InCell, InCell, InterpolationMethod).

References: "Two hierarchies of spline interpolations. Practical algorithms for multivariate higher order splines." Cristian Constantin Lalescu, May 21, 2009.

[ILNumerics Interpolation Toolbox]

See Also

Reference

InterpolationInternal.interpn(InArraySingle, NullableSingle, InCell, InCell, InterpolationMethod)
InterpolationInternal.splinepath(InArraySingle, InArraySingle, InArraySingle, InArraySingle, Int32)