KernelProcessor<T> Class

Abstract base class for computing convolution, correlation, and autocorrelation of signals.

Definition

Namespace: Numerics.NET.SignalProcessing
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.0.0
C#
public abstract class KernelProcessor<T>
Inheritance
Object  →  KernelProcessor<T>
Derived

Type Parameters

T
The element type (T for real kernels, Complex<T> for complex kernels).

Remarks

This class provides high-performance 1D convolution and correlation operations with flexible boundary handling and output modes. It supports both real and complex-valued signals.

Convolution vs. Correlation:

  • Convolution: y[n] = Σ_m x[n - (m - a)] · h[m], where a is the anchor index. This is the standard operation for filtering and feature detection.
  • Correlation: y[n] = Σ_m x[n - (m - a)] · conj(h[m]). This is used for template matching and signal similarity measurement.

Comparison with other libraries:

Constructors

KernelProcessor<T> Initializes a new instance of the KernelProcessor<T> class.

Properties

Anchor Gets the kernel anchor configuration that determines the alignment between kernel and signal.
KernelLength Gets the length of the kernel.
KernelSpan Gets a read-only span view of the kernel array for internal use by derived classes.
Mode Gets the output mode that determines the size and alignment of the convolution/correlation result.
Padding Gets the signal padding mode used for boundary extension.
ProcessingMethod Gets the processing method used for convolution/correlation computation.

Methods

AutoCorrelate(Vector<T>) Computes the autocorrelation of a vector (allocating).
AutoCorrelate(ReadOnlySpan<T>, Span<T>) Computes the autocorrelation of a signal.
AutoCorrelate(Vector<T>, Vector<T>) Computes the autocorrelation of a vector (non-allocating).
AutoCorrelate(Int32, ReadOnlySpan<T>, Int32, Int32, Span<T>, Int32) Computes the autocorrelation of a signal.
Convolve(Vector<T>) Computes the convolution of a vector with the stored kernel (allocating).
Convolve(ReadOnlySpan<T>, Span<T>) Computes the convolution of a signal with the stored kernel.
Convolve(Vector<T>, Vector<T>) Computes the convolution of a vector with the stored kernel (non-allocating).
Convolve(Int32, ReadOnlySpan<T>, Int32, Int32, Span<T>, Int32) Computes the convolution of a signal with the stored kernel.
Correlate(Vector<T>) Computes the cross-correlation of a vector with the stored kernel (allocating).
Correlate(ReadOnlySpan<T>, Span<T>) Computes the cross-correlation of a signal with the stored kernel.
Correlate(Vector<T>, Vector<T>) Computes the cross-correlation of a vector with the stored kernel (non-allocating).
Correlate(Int32, ReadOnlySpan<T>, Int32, Int32, Span<T>, Int32) Computes the cross-correlation of a signal with the stored kernel.
EqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
FillHalos Fills the head and tail halos of a work buffer based on the specified padding mode.
FinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
FromKernel(Complex<T>[], ConvolutionMode, Int32) Creates a kernel processor for complex-valued kernels with default anchor and padding.
FromKernel(T[], ConvolutionMode, Int32) Creates a kernel processor for real-valued kernels with default anchor and padding.
FromKernel(Complex<T>[], KernelAnchor, ConvolutionMode, SignalPadding, KernelProcessingMethod, Int32) Creates a kernel processor for complex-valued kernels.
FromKernel(T[], KernelAnchor, ConvolutionMode, SignalPadding, KernelProcessingMethod, Int32) Creates a kernel processor for real-valued kernels.
GetHashCodeServes as the default hash function.
(Inherited from Object)
GetOutputLength Calculates the expected output length for a given signal length based on the convolution mode.
GetTypeGets the Type of the current instance.
(Inherited from Object)
MemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
ShouldUseFft Determines whether to use FFT-based or direct implementation based on signal and kernel sizes.
ToStringReturns a string that represents the current object.
(Inherited from Object)

See Also