TensorSplineGridSurface Class

N-dimensional tensor-product grid surface using pluggable 1D spline kernels.

Definition

Namespace: Numerics.NET.Curves.Surfaces
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.1.0
C#
public sealed class TensorSplineGridSurface : GridSurface
Inheritance
Object  →  Surface  →  GridSurface  →  TensorSplineGridSurface

Remarks

This class implements general N-dimensional interpolation on rectilinear grids using tensor-product decomposition: interpolation is performed by recursively applying a 1D spline kernel along each axis (dimension reduction). The kernel is specified via the ISplineKernel1D interface, allowing flexible interpolation methods.

Supported kernels:

  • Linear: 2-point linear interpolation.
  • CubicHermite: 4-point cubic Hermite with centered finite differences (Catmull-Rom style). This is the default kernel.
  • Custom kernels implementing ISplineKernel1D (e.g., PCHIP, monotone cubic).

Boundary conditions: The GridBoundaryCondition parameter controls how the kernel accesses grid values during stencil assembly when the stencil extends beyond the grid bounds. Supported modes include clamp (default), periodic, reflect, and fill with a constant value.

Performance: All evaluation methods (value, gradient, Hessian) perform zero heap allocations on the hot path by using stack-allocated buffers. The tensor-product evaluation is efficient for moderate dimensions (typically up to 4-6 dimensions in practice).

Relation to specialized 2D/3D surfaces: This class provides a general implementation that works for any dimension. For 2D and 3D grids, specialized implementations (CubicGridSurface2D, CubicGridSurface3D) may offer better performance by precomputing derivatives, but they are limited to natural cubic splines and do not support custom kernels or boundary conditions.

Properties

Dimension Gets the number of dimensions of the input space.
(Inherited from Surface)
Values Gets a read-only span containing the values of at the data points.
(Inherited from GridSurface)

Methods

EqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
Evaluate(Double[]) Evaluates the surface at the specified point.
(Inherited from Surface)
Evaluate(IReadOnlyList<Double>) Evaluates the surface at the specified point.
(Inherited from Surface)
Evaluate(ReadOnlySpan<Double>) Evaluates the surface at the specified point.
(Inherited from GridSurface)
Evaluate(IReadOnlyList<Vector<Double>>, Span<Double>) Evaluates the surface at multiple points specified by a list of vectors.
(Inherited from Surface)
Evaluate(ReadOnlySpan<Double>, ExtrapolationMode) Evaluates the surface at the specified point.
(Inherited from GridSurface)
Evaluate(ReadOnlySpan<Vector<Double>>, Span<Double>) Evaluates the surface at multiple points specified by a read-only span of vectors.
(Inherited from Surface)
Evaluate(Int32, ReadOnlySpan2D<Double>, Span<Double>) Evaluates the surface at multiple points stored in column-major layout.
(Inherited from Surface)
EvaluateHessian Evaluates the Hessian matrix at the specified point.
GetHashCodeServes as the default hash function.
(Inherited from Object)
GetTypeGets the Type of the current instance.
(Inherited from Object)
Gradient(Vector<Double>) Computes the gradient of the surface at the specified point.
(Inherited from Surface)
Gradient(Double, Double) Computes the gradient of a 2D surface at the specified point.
(Inherited from Surface)
Gradient(ReadOnlySpan<Double>, Span<Double>) Computes the gradient of the scalar field at the specified point.
(Inherited from GridSurface)
Gradient(Vector<Double>, Vector<Double>) Computes the gradient of the surface at the specified point.
(Inherited from Surface)
Gradient(ReadOnlySpan<Double>, ExtrapolationMode, Span<Double>)
(Inherited from GridSurface)
Gradients(Matrix<Double>) Computes the gradients of the surface at multiple points.
(Inherited from Surface)
Gradients(Matrix<Double>, Matrix<Double>) Computes the gradients of the surface at multiple points.
(Inherited from Surface)
Hessian Computes the Hessian matrix of the surface at the specified point.
(Inherited from Surface)
ToStringReturns a string that represents the current object.
(Inherited from Object)

See Also