ILNumerics Ultimate VS

Interpolationsplinen Method (InArrayDouble, InCell, InCell)

ILNumerics Ultimate VS Documentation
ILNumerics - Technical Application Development
N-dimensional cubic spline interpolation for gridded points from a given data grid.

[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<double> splinen(
	InArray<double> V,
	InCell X = null,
	InCell Xn = null
)

Parameters

V
Type: ILNumericsInArrayDouble
Known values, N-dimensional array, at least 4 elements in each dimension are required.
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: RetArrayDouble
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(InArrayDouble, 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: Array<T> corresponding to element type T of V) with strictly monotonically increasing range specifications for the corresponding dimension in V. The spacing between elements must not be uniform.

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

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. the corresponding cell element 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(InArrayDouble, InArrayDouble, InArrayDouble, OutArrayDouble, OutArrayDouble). 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. Note that all n-dimensional functions expect the common order of dimensions: 1st dimension goes along the columns, 2nd dimension goes along the rows. This (intentionally) differs from the somehow mixed-up way meshgrid(InArrayDouble, InArrayDouble, InArrayDouble, OutArrayDouble, OutArrayDouble) offers.

Any values from Xn laying outside of the range of X are marked as NaN. Use the 2nd non-optional parameter from the overload splinen(InArrayDouble, NullableDouble, InCell, InCell) in order to control this value or to get extrapolated values instead.

Algorithm: The new query points are computed by efficient, subsequent one-dimensional spline interpolations via spline(InArrayDouble, InArrayDouble, InArrayDouble, InArrayDouble, InArrayDouble). Good performance is achieved via efficient parallelization in the underlying SplineInterpolatorDouble object.

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(InArrayDouble, InCell, InCell, InterpolationMethod) for an alternative on data with NaN values.

This n-dimensional spline interpolation is called from interpn(InArrayDouble, NullableDouble, 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(InArrayDouble, NullableDouble, InCell, InCell, InterpolationMethod)
InterpolationInternal.splinepath(InArrayDouble, InArrayDouble, InArrayDouble, InArrayDouble, Int32)