Spline Kernels Class
Definition
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.1.0
public static class SplineKernels- Inheritance
- Object → SplineKernels
Remarks
This class serves as a registry for standard spline kernels (ISplineKernel1D) used by tensor-product grid interpolation. All built-in kernels are stateless singletons and are safe for concurrent use across threads.
Available kernels:
- Linear: 2-point piecewise linear interpolation. Simple and fast, but only C⁰ continuous (discontinuous first derivative at knots).
- CubicHermite: 4-point cubic Hermite interpolation using centered finite differences to compute slopes (Catmull-Rom style). This kernel is C¹ continuous and provides smooth interpolation with continuous first derivatives. It is the default kernel for CreateCubicTensorSpline(IReadOnlyList<IReadOnlyList<Double>>, IReadOnlyList<Double>, GridBoundaryCondition, ExtrapolationMode).
Kernel characteristics:
- Local vs global: All built-in kernels are local, meaning they use only a fixed-width stencil of neighboring points. They do not require solving global systems (unlike Natural or Clamped cubic splines from CubicSpline).
- Non-uniform grid support: All kernels work correctly with non-uniform grids (variable spacing between knots).
- Zero allocation: All kernel evaluation methods perform no heap allocations and are suitable for high-performance tensor-product evaluation loops.
Custom kernels: Users can implement ISplineKernel1D to provide custom interpolation behavior (e.g., PCHIP for monotone-preserving cubic interpolation, quintic splines for C² continuity, or domain-specific kernels). Custom kernels can then be used via CreateTensorSpline(IReadOnlyList<IReadOnlyList<Double>>, IReadOnlyList<Double>, ISplineKernel1D, GridBoundaryCondition, ExtrapolationMode).
Relation to CubicSpline: The CubicHermite kernel is not equivalent to any CubicSplineKind. It is a local cubic method, while CubicSplineKind options (Natural, Clamped, NotAKnot) are global methods that solve tridiagonal systems. For 2D/3D surfaces built directly from CubicSpline, see the specialized 2D/3D cubic surface implementations created via [!:GridSurface.CreateCubic(Vector<double>, Vector<double>, Matrix<double>)].
Properties
| Cubic | Gets the standard 4-point cubic Hermite interpolation kernel with centered finite differences. |
| Linear | Gets the standard 2-point linear interpolation kernel. |