Interpolation.GridNearestInterpolator Method

Definition

Namespace: Numerics.NET
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.1.0

Overload List

GridNearestInterpolator(IReadOnlyList<IReadOnlyList<Double>>, IReadOnlyList<Double>, ExtrapolationMode) Creates a grid-based nearest-neighbor interpolator over an N-dimensional rectilinear grid.
GridNearestInterpolator(IReadOnlyList<Double>, IReadOnlyList<Double>, Matrix<Double>, ExtrapolationMode) Creates a grid-based nearest-neighbor interpolator over a 2D rectilinear grid.
GridNearestInterpolator(IReadOnlyList<Double>, IReadOnlyList<Double>, IReadOnlyList<Double>, ExtrapolationMode) Creates a grid-based nearest-neighbor interpolator over a 2D rectilinear grid.
GridNearestInterpolator(IReadOnlyList<Double>, IReadOnlyList<Double>, Double[,], ExtrapolationMode) Creates a grid-based nearest-neighbor interpolator over a 2D rectilinear grid.
GridNearestInterpolator(IReadOnlyList<Double>, IReadOnlyList<Double>, IReadOnlyList<Double>, IReadOnlyList<Double>, ExtrapolationMode) Creates a grid-based nearest-neighbor interpolator over a 3D rectilinear grid.
GridNearestInterpolator(IReadOnlyList<Double>, IReadOnlyList<Double>, IReadOnlyList<Double>, Double[,,], ExtrapolationMode) Creates a grid-based nearest-neighbor interpolator over a 3D rectilinear grid.

GridNearestInterpolator(IReadOnlyList<IReadOnlyList<Double>>, IReadOnlyList<Double>, ExtrapolationMode)

Creates a grid-based nearest-neighbor interpolator over an N-dimensional rectilinear grid.
C#
public static NearestGridSurface GridNearestInterpolator(
	IReadOnlyList<IReadOnlyList<double>> axes,
	IReadOnlyList<double> values,
	ExtrapolationMode extrapolation = ExtrapolationMode.Throw
)

Parameters

axes  IReadOnlyList<IReadOnlyList<Double>>
The coordinate vectors for each dimension.
values  IReadOnlyList<Double>
The grid values in flat, row-major storage.
extrapolation  ExtrapolationMode  (Optional)
The extrapolation mode for out-of-range coordinates.

Return Value

NearestGridSurface
A NearestGridSurface that performs nearest-neighbor grid interpolation.

Exceptions

ArgumentNullExceptionaxes or values is null.
ArgumentException The product of axis lengths does not equal the values length, or an axis has fewer than 2 points.

GridNearestInterpolator(IReadOnlyList<Double>, IReadOnlyList<Double>, Matrix<Double>, ExtrapolationMode)

Creates a grid-based nearest-neighbor interpolator over a 2D rectilinear grid.
C#
public static NearestGridSurface GridNearestInterpolator(
	IReadOnlyList<double> xAxis,
	IReadOnlyList<double> yAxis,
	Matrix<double> values,
	ExtrapolationMode extrapolation = ExtrapolationMode.Throw
)

Parameters

xAxis  IReadOnlyList<Double>
The x-coordinates of the grid points.
yAxis  IReadOnlyList<Double>
The y-coordinates of the grid points.
values  Matrix<Double>
The grid values as a matrix (RowCount = xAxis.Count, ColumnCount = yAxis.Count).
extrapolation  ExtrapolationMode  (Optional)
The extrapolation mode for out-of-range coordinates.

Return Value

NearestGridSurface
A NearestGridSurface that performs 2D nearest-neighbor interpolation.

Exceptions

ArgumentNullExceptionxAxis, yAxis, or values is null.
ArgumentException Matrix dimensions do not match axis lengths, or an axis has fewer than 2 points.

GridNearestInterpolator(IReadOnlyList<Double>, IReadOnlyList<Double>, IReadOnlyList<Double>, ExtrapolationMode)

Creates a grid-based nearest-neighbor interpolator over a 2D rectilinear grid.
C#
public static NearestGridSurface GridNearestInterpolator(
	IReadOnlyList<double> xAxis,
	IReadOnlyList<double> yAxis,
	IReadOnlyList<double> values,
	ExtrapolationMode extrapolation = ExtrapolationMode.Throw
)

Parameters

xAxis  IReadOnlyList<Double>
The x-coordinates of the grid points.
yAxis  IReadOnlyList<Double>
The y-coordinates of the grid points.
values  IReadOnlyList<Double>
The grid values in flat, row-major storage.
extrapolation  ExtrapolationMode  (Optional)
The extrapolation mode for out-of-range coordinates.

Return Value

NearestGridSurface
A NearestGridSurface that performs 2D nearest-neighbor interpolation.

Exceptions

ArgumentNullExceptionxAxis, yAxis, or values is null.
ArgumentException The values length does not match the product of axis lengths, or an axis has fewer than 2 points.

GridNearestInterpolator(IReadOnlyList<Double>, IReadOnlyList<Double>, Double[,], ExtrapolationMode)

Creates a grid-based nearest-neighbor interpolator over a 2D rectilinear grid.
C#
public static NearestGridSurface GridNearestInterpolator(
	IReadOnlyList<double> xAxis,
	IReadOnlyList<double> yAxis,
	double[,] values,
	ExtrapolationMode extrapolation = ExtrapolationMode.Throw
)

Parameters

xAxis  IReadOnlyList<Double>
The x-coordinates of the grid points.
yAxis  IReadOnlyList<Double>
The y-coordinates of the grid points.
values  Double[2]
The grid values as a 2D array.
extrapolation  ExtrapolationMode  (Optional)
The extrapolation mode for out-of-range coordinates.

Return Value

NearestGridSurface
A NearestGridSurface that performs 2D nearest-neighbor interpolation.

Remarks

Array dimension order

For the values array, the dimension order follows the order of the axis arguments.

The array must satisfy:

  • values.GetLength(0) == xAxis.Count
  • values.GetLength(1) == yAxis.Count

and values[i, j] = f(xAxis[i], yAxis[j]).

Exceptions

ArgumentNullExceptionxAxis, yAxis, or values is null.
ArgumentException Array dimensions do not match axis lengths, or an axis has fewer than 2 points.

GridNearestInterpolator(IReadOnlyList<Double>, IReadOnlyList<Double>, IReadOnlyList<Double>, IReadOnlyList<Double>, ExtrapolationMode)

Creates a grid-based nearest-neighbor interpolator over a 3D rectilinear grid.
C#
public static NearestGridSurface GridNearestInterpolator(
	IReadOnlyList<double> xAxis,
	IReadOnlyList<double> yAxis,
	IReadOnlyList<double> zAxis,
	IReadOnlyList<double> values,
	ExtrapolationMode extrapolation = ExtrapolationMode.Throw
)

Parameters

xAxis  IReadOnlyList<Double>
The x-coordinates of the grid points.
yAxis  IReadOnlyList<Double>
The y-coordinates of the grid points.
zAxis  IReadOnlyList<Double>
The z-coordinates of the grid points.
values  IReadOnlyList<Double>
The grid values in flat, row-major storage.
extrapolation  ExtrapolationMode  (Optional)
The extrapolation mode for out-of-range coordinates.

Return Value

NearestGridSurface
A NearestGridSurface that performs 3D nearest-neighbor interpolation.

Exceptions

ArgumentNullExceptionxAxis, yAxis, zAxis, or values is null.
ArgumentException The values length does not match the product of axis lengths, or an axis has fewer than 2 points.

GridNearestInterpolator(IReadOnlyList<Double>, IReadOnlyList<Double>, IReadOnlyList<Double>, Double[,], ExtrapolationMode)

Creates a grid-based nearest-neighbor interpolator over a 3D rectilinear grid.
C#
public static NearestGridSurface GridNearestInterpolator(
	IReadOnlyList<double> xAxis,
	IReadOnlyList<double> yAxis,
	IReadOnlyList<double> zAxis,
	double[,,] values,
	ExtrapolationMode extrapolation = ExtrapolationMode.Throw
)

Parameters

xAxis  IReadOnlyList<Double>
The x-coordinates of the grid points.
yAxis  IReadOnlyList<Double>
The y-coordinates of the grid points.
zAxis  IReadOnlyList<Double>
The z-coordinates of the grid points.
values  Double[3]
The grid values as a 3D array.
extrapolation  ExtrapolationMode  (Optional)
The extrapolation mode for out-of-range coordinates.

Return Value

NearestGridSurface
A NearestGridSurface that performs 3D nearest-neighbor interpolation.

Remarks

Array dimension order

For the values array, the dimension order follows the order of the axis arguments.

The array must satisfy:

  • values.GetLength(0) == xAxis.Count
  • values.GetLength(1) == yAxis.Count
  • values.GetLength(2) == zAxis.Count

and values[i, j, k] = f(xAxis[i], yAxis[j], zAxis[k]).

Exceptions

ArgumentNullExceptionxAxis, yAxis, zAxis, or values is null.
ArgumentException Array dimensions do not match axis lengths, or an axis has fewer than 2 points.

See Also