Surface Class

Represents a scalar-valued function on ℝⁿ.

Definition

Namespace: Numerics.NET.Curves.Surfaces
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.1.0
C#
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):

TypeDescription
NearestGridSurfaceNearest-neighbor interpolation on N-dimensional rectilinear grids. Fast but discontinuous. Created via GridNearestInterpolator(IReadOnlyList<IReadOnlyList<Double>>, IReadOnlyList<Double>, ExtrapolationMode).
LinearGridSurfaceMultilinear (bilinear/trilinear) interpolation on N-dimensional rectilinear grids. Continuous but with discontinuous first derivatives. Created via GridLinearInterpolator(IReadOnlyList<IReadOnlyList<Double>>, IReadOnlyList<Double>, ExtrapolationMode).
CubicGridSurface2DSpecialized bicubic spline interpolation for 2D rectilinear grids using natural cubic splines (C² continuity). Precomputes derivatives for fast evaluation. Created via [!:Interpolation.GridCubicInterpolator] for 2D.
CubicGridSurface3DSpecialized tricubic spline interpolation for 3D rectilinear grids using natural cubic splines (C² continuity). Precomputes derivatives for fast evaluation. Created via [!:Interpolation.GridCubicInterpolator] for 3D.
TensorSplineGridSurfaceGeneral 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:

TypeDescription
NearestScatterSurfaceNearest-neighbor interpolation for scattered N-dimensional data. Returns the value of the closest data point. Created via ScatteredNearestInterpolator(Matrix<Double>, Vector<Double>).
RbfSurfaceRadial 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).
TriangulatedSurface2DDelaunay 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:

The batched evaluation methods have default implementations that call the single-point method, but you may override them for better performance.

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

EqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
Evaluate(Double[]) Evaluates the surface at the specified point.
Evaluate(IReadOnlyList<Double>) Evaluates the surface at the specified point.
Evaluate(ReadOnlySpan<Double>) Evaluates the surface at the specified point.
Evaluate(IReadOnlyList<Vector<Double>>, Span<Double>) Evaluates the surface at multiple points specified by a list of vectors.
Evaluate(ReadOnlySpan<Vector<Double>>, Span<Double>) Evaluates the surface at multiple points specified by a read-only span of vectors.
Evaluate(Int32, ReadOnlySpan2D<Double>, Span<Double>) Evaluates the surface at multiple points stored in column-major layout.
FinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
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.
Gradient(Double, Double) Computes the gradient of a 2D surface at the specified point.
Gradient(ReadOnlySpan<Double>, Span<Double>) Computes the gradient of the surface at the specified point.
Gradient(Vector<Double>, Vector<Double>) Computes the gradient of the surface at the specified point.
Gradients(Matrix<Double>) Computes the gradients of the surface at multiple points.
Gradients(Matrix<Double>, Matrix<Double>) Computes the gradients of the surface at multiple points.
Hessian Computes the Hessian matrix of the surface at the specified point.
MemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
ToStringReturns a string that represents the current object.
(Inherited from Object)

See Also