Interpolation.Inverse Linear After Method
Definition
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.0.0
Overload List
| Inverse | Performs inverse linear interpolation to find the smallest x-coordinate ≥ a reference value where the interpolated curve equals a given y-value. |
| Inverse | Performs inverse linear interpolation to find the smallest x-coordinate ≥ a reference value where the interpolated curve equals a given y-value. |
InverseLinearAfter(Double[], Double[], Double, Double)
public static double InverseLinearAfter(
double[] xValues,
double[] yValues,
double y,
double x
)Parameters
- xValues Double[]
- The x-coordinates of the data points. Must be strictly increasing.
- yValues Double[]
- The y-coordinates of the data points. Can be non-monotone.
- y Double
- The y-coordinate for which to find the corresponding x-coordinate.
- x Double
- The reference x-coordinate. The method returns the smallest solution ≥ this value.
Return Value
DoubleThe smallest x-coordinate ≥ x where the interpolated curve equals y.
Remarks
This method is designed for non-monotone data where multiple solutions may exist. It scans all consecutive pairs and returns the smallest x-coordinate ≥ x where the curve crosses y.
For flat segments where yi = yi+1 = y, the reference x is projected onto the interval and used as a candidate solution.
This method makes no allocations and is suitable for performance-critical scenarios.
Exceptions
| Argument | xValues or yValues is null. |
| Dimension | The lengths of xValues and yValues do not match. |
| Argument | xValues does not have at least 2 elements, or the values in xValues are not strictly increasing. |
| Invalid | No solution exists (y does not intersect the interpolated curve at any x ≥ the reference value). |
InverseLinearAfter(ReadOnlySpan<Double>, ReadOnlySpan<Double>, Double, Double)
public static double InverseLinearAfter(
ReadOnlySpan<double> xValues,
ReadOnlySpan<double> yValues,
double y,
double x
)Parameters
- xValues ReadOnlySpan<Double>
- The x-coordinates of the data points. Must be strictly increasing.
- yValues ReadOnlySpan<Double>
- The y-coordinates of the data points. Can be non-monotone.
- y Double
- The y-coordinate for which to find the corresponding x-coordinate.
- x Double
- The reference x-coordinate. The method returns the smallest solution ≥ this value.
Return Value
DoubleThe smallest x-coordinate ≥ x where the interpolated curve equals y.
Remarks
This method is designed for non-monotone data where multiple solutions may exist. It scans all consecutive pairs and returns the smallest x-coordinate ≥ x where the curve crosses y.
For flat segments where yi = yi+1 = y, the reference x is projected onto the interval and used as a candidate solution.
This method makes no allocations and is suitable for performance-critical scenarios.
Exceptions
| Argument | xValues or yValues is null. |
| Dimension | The lengths of xValues and yValues do not match. |
| Argument | xValues does not have at least 2 elements, or the values in xValues are not strictly increasing. |
| Invalid | No solution exists (y does not intersect the interpolated curve at any x ≥ the reference value). |