Surface Class
Definition
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.1.0
public abstract class Surface- Inheritance
- Object → Surface
- Derived
Remarks
The Surface class is the abstract base class for classes that represent scalar-valued functions on N-dimensional real space, mapping a point p ∈ ℝⁿ to a single real value.
The dimensionality of the input space is specified by the Dimension property. All input points must have exactly Dimension components.
This class provides single-point evaluation via the Evaluate(ReadOnlySpan<Double>) method and batched evaluation methods for improved performance when evaluating the function at multiple points.
The Surface class is intended as the foundation for N-dimensional interpolation implementations, machine learning applications, and other scenarios requiring continuous scalar functions in arbitrary dimensions.
Specialized Surface Types
The library provides several specialized surface implementations for common use cases:
Grid-Based Surfaces (Rectilinear Grids):
| Type | Description |
|---|---|
| Nearest | Nearest-neighbor interpolation on N-dimensional rectilinear grids. Fast but discontinuous. Created via GridNearestInterpolator(IReadOnlyList<IReadOnlyList<Double>>, IReadOnlyList<Double>, ExtrapolationMode). |
| Linear | Multilinear (bilinear/trilinear) interpolation on N-dimensional rectilinear grids. Continuous but with discontinuous first derivatives. Created via GridLinearInterpolator(IReadOnlyList<IReadOnlyList<Double>>, IReadOnlyList<Double>, ExtrapolationMode). |
| Cubic | Specialized bicubic spline interpolation for 2D rectilinear grids using natural cubic splines (C² continuity). Precomputes derivatives for fast evaluation. Created via [!:Interpolation.GridCubicInterpolator] for 2D. |
| Cubic | Specialized tricubic spline interpolation for 3D rectilinear grids using natural cubic splines (C² continuity). Precomputes derivatives for fast evaluation. Created via [!:Interpolation.GridCubicInterpolator] for 3D. |
| Tensor | General N-dimensional tensor-product spline interpolation on rectilinear grids. Uses pluggable 1D kernels (cubic Hermite by default with C¹ continuity). Supports custom boundary conditions. Created via GridCubicTensorSplineInterpolator(IReadOnlyList<IReadOnlyList<Double>>, IReadOnlyList<Double>, GridBoundaryCondition, ExtrapolationMode). |
Scattered Data Surfaces:
| Type | Description |
|---|---|
| Nearest | Nearest-neighbor interpolation for scattered N-dimensional data. Returns the value of the closest data point. Created via ScatteredNearestInterpolator(Matrix<Double>, Vector<Double>). |
| Rbf | Radial basis function (RBF) interpolation for scattered N-dimensional data. Smooth interpolant passing through all data points. Supports various kernels and regularization. Created via ScatteredRbfInterpolator(Matrix<Double>, Vector<Double>, RbfOptions). |
| Triangulated | Delaunay triangulation-based linear interpolation for scattered 2D data. Performs barycentric interpolation within triangles. Created via ScatteredLinear2DInterpolator(Vector<Double>, Vector<Double>, Vector<Double>, ExtrapolationMode). |
See the Interpolation class for factory methods to create these surfaces.
The batched evaluation methods support two input formats:
- A collection of Vector<T> objects, where each vector represents a single point in N-dimensional space.
- A ReadOnlySpan2D<T> representing points in a column-major layout, where each column represents one point and rows represent the coordinate dimensions.
Notes to inheritors: When you derive from Surface, you must:
- Call the protected constructor with the appropriate dimension.
- Override the Evaluate(ReadOnlySpan<Double>) method.
Constructors
| Surface | Initializes a new instance of the Surface class with the specified dimension. |
Properties
| Dimension | Gets the number of dimensions of the input space. |
Methods
| Equals | Determines whether the specified object is equal to the current object. (Inherited from Object) |
| Evaluate(Double[]) | Evaluates the surface at the specified point. |
| Evaluate( | Evaluates the surface at the specified point. |
| Evaluate( | Evaluates the surface at the specified point. |
| Evaluate( | Evaluates the surface at multiple points specified by a list of vectors. |
| Evaluate( | Evaluates the surface at multiple points specified by a read-only span of vectors. |
| Evaluate( | Evaluates the surface at multiple points stored in column-major layout. |
| Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object) |
| Get | Serves as the default hash function. (Inherited from Object) |
| Get | Gets the Type of the current instance. (Inherited from Object) |
| Gradient( | Computes the gradient of the surface at the specified point. |
| Gradient( | Computes the gradient of a 2D surface at the specified point. |
| Gradient( | Computes the gradient of the surface at the specified point. |
| Gradient( | Computes the gradient of the surface at the specified point. |
| Gradients( | Computes the gradients of the surface at multiple points. |
| Gradients( | Computes the gradients of the surface at multiple points. |
| Hessian | Computes the Hessian matrix of the surface at the specified point. |
| Memberwise | Creates a shallow copy of the current Object. (Inherited from Object) |
| ToString | Returns a string that represents the current object. (Inherited from Object) |