Click or drag to resize

RMathFindNearestIndex Method

Finds the (fractional) index of the nearest element in the xVector to the xValue.

Namespace: Altaxo.Calc
Assembly: AltaxoCore (in AltaxoCore.dll) Version: 4.8.3448.0 (4.8.3448.0)
Syntax
C#
public static (double index, bool isExact) FindNearestIndex(
	IReadOnlyList<double> xVector,
	double xValue
)

Parameters

xVector  IReadOnlyListDouble
The x vector.
xValue  Double
The x value.

Return Value

ValueTupleDouble, Boolean
A tuple, consisting of the nearest index, and a boolean value. If any element of the xVector is equal to xValue, the boolean value is true. Also, if xValue is between two elements of the xVector, the boolean value is true. Otherwise, the boolean value is false, for instance, if the xValue is outside the limit of the elements of the xVector.
Exceptions
ExceptionCondition
ArgumentNullExceptionxVector
ArgumentExceptionThe list must not be empty. - xVector
See Also