ILNumerics Ultimate VS

LinearInterpolatorDouble Constructor

ILNumerics Ultimate VS Documentation
ILNumerics - Technical Application Development
Creates a linear interpolations object, using specified points X and V

[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 LinearInterpolatorDouble(
	InArray<double> V,
	InArray<double> X,
	Nullable<double> outOfRangeValues = null
)

Parameters

V
Type: ILNumericsInArrayDouble
Given values. Vector of length n or n-dimensional array of size [m, l1, l2, ..., ln].
X
Type: ILNumericsInArrayDouble
Strictly monotonically increasing x coordinates. Vector or n-dimensional array of length m.
outOfRangeValues (Optional)
Type: SystemNullableDouble
[Optional] Value to be assigned to all interpolation results outside of the domain specified by X. Default: (null) extrapolate.
Exceptions

ExceptionCondition
ArgumentExceptionIf arguments length X or V less than 2 elements
ArgumentExceptionIf argument X not ascending and distinct
ArgumentExceptionIf arguments X or V are specified not as vector or array.
ArgumentNullExceptionIf any of input parameters are NULL
ArgumentExceptionIf arguments X or V have different size.
Remarks

This object should be used in a using block in order to clean up its resources after use.

For an input vector V, LinearInterpolatorDouble prepares a 1-dimensional, linear interpolation object, 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 LinearInterpolatorDouble 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.NumberOfElements / V.S[0].

If V is defined as vector row or column with size m, number of elements X must be m

[ILNumerics Interpolation Toolbox]

Examples

// Define some sample points as a function: f(x) = sin(x);
Array<double> X = linspace<double>(-pi, pi, 10);
Array<double> V = sin(X);

// Create Interpolator Object
using (var interp = new LinearInterpolatorDouble(V, X)) 
{ 
    // Get some random scalar values
    double val1 = (double)interp.Apply(0.024);
    double val2 = (double)interp.Apply(-0.21);

    // Get 10 linear spaced values defined on range (-0.5, 1.25)
    Array<double> valRange = interp.Apply(linspace<double>(-0.5, 1.25, 10));

    // Get 30 interpolated values using Xn query points defined as array[3 x 2 x 5]
    Array<double> Xn = counter(0.0, 0.1, 3, 2, 5);
    Array<double> Vn = interp.Apply(Xn);
}

See Also

Reference