[ILNumerics Interpolation Toolbox]
Namespace: ILNumerics.Toolboxes
Assembly: ILNumerics.Toolboxes.Interpolation (in ILNumerics.Toolboxes.Interpolation.dll) Version: 5.5.0.0 (5.5.7503.3146)
public PolynomialInterpolatorSingle( InArray<float> V, InArray<float> X, Nullable<float> outOfRangeValues = null, int order = 0 )
Parameters
- V
- Type: ILNumericsInArraySingle
Given values. Vector of length m or n-dimensional array of size [m, l1, l2, ..., ln]. - X
- Type: ILNumericsInArraySingle
Strictly monotonically increasing x coordinates. Vector or n-dimensional array with m elements. - outOfRangeValues (Optional)
- Type: SystemNullableSingle
[Optional] Value to be assigned to all interpolation results outside of the domain specified by X. Default: (null) extrapolate. - order (Optional)
- Type: SystemInt32
[Optional] Defines the order of the Lagrange polynom used for interpolation. Default: (0) method Apply(InArraySingle, InCell) returns V.
Exception | Condition |
---|---|
ArgumentException | If argument X not ascending and distinct |
ArgumentException | If arguments X or V are specified not as vector or array. |
ArgumentException | If order value is less than 0 or more than length of X |
ArgumentNullException | If any of input parameters are NULL |
ArgumentException | If arguments X or V have different size. |
For an input vector V, PolynomialInterpolatorSingle prepares a 1-dimensional, Lagrange-Polynomial interpolation object of order = order, for the given set of m measured values. Subsequently, interpolated values can be derived by help of this object efficiently. After all values have been acquired, the object should be released in order to free its resources. Commonly, in .NET, the utiliziation of PolynomialInterpolatorSingle inside of a using directive is recommended.
Once created object could be reused to get interpolated values using Apply() method.
If V is provided as a matrix or a n-dim array, the columns of V are considered as m individual sets of measurements, all at the same positions as determined by X. It performs interpolation through the columns of sample values V. Each element requested in Apply(Xn) method will be interpolated for each column of V. In this case m becomes: V.S[0].
If V is defined as vector row or column with size m, number of elements X must be m.
Values of order larger than 7 are not recommeded to prevent from loss of precision.
[ILNumerics Interpolation Toolbox]
// Define some sample points as a function: f(x) = sin(x); Array<float> X = linspace<float>(-pi, pi, 10); Array<float> V = sin(X); // Create Interpolator Object order 5 using (var interp = new PolynomialInterpolatorSingle(V, X, order:5)) { // Get some random scalar values float val1 = (float)interp.Apply(0.024); float val2 = (float)interp.Apply(-0.21); // Get 10 linear spaced values defined on range (-0.5, 1.25) Array<float> valRange = interp.Apply(linspace<float>(-0.5, 1.25, 10)); // Get 30 interpolated values using Xn query points defined as array[3 x 2 x 5] Array<float> Xn = counter(0.0, 0.1, 3, 2, 5); Array<float> Vn = interp.Apply(Xn); }