Real Kernel Processor<T>.Convolve Method
Definition
Namespace: Numerics.NET.SignalProcessing
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.0.0
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.0.0
Overload List
| Convolve( | Computes the convolution of a vector with the stored kernel (allocating). |
| Convolve( | Computes the convolution of a signal with the stored kernel. |
| Convolve( | Computes the convolution of a vector with the stored kernel (non-allocating). |
| Convolve( | Computes the convolution of a real signal with the stored kernel. |
Convolve(Int32, ReadOnlySpan<T>, Int32, Int32, Span<T>, Int32)
Computes the convolution of a real signal with the stored kernel.
public override void Convolve(
int signalLength,
ReadOnlySpan<T> signal,
int signalStride,
int resultLength,
Span<T> result,
int resultStride
)Parameters
- signalLength Int32
- The length of the input signal.
- signal ReadOnlySpan<T>
- A read-only span containing the real input signal.
- signalStride Int32
- The stride between successive elements in the signal. Use 1 for contiguous data.
- resultLength Int32
- The expected length of the result (should match GetOutputLength(Int32)).
- result Span<T>
- A span to store the convolution result. Must have capacity for at least resultLength elements.
- resultStride Int32
- The stride between successive elements in the result. Use 1 for contiguous output.
Remarks
Real convolution computes: y[n] = Σ_m x[n - (m - a)] · h[m], where a is the anchor index. This is the standard discrete convolution operation used in digital signal processing and filtering.
This method automatically selects between direct (time-domain) and FFT (frequency-domain) algorithms based on the ProcessingMethod setting and signal/kernel sizes. The direct method is typically faster for small kernels, while FFT is more efficient for large kernels.
Comparison with other libraries:
- NumPy np.convolve(signal, kernel, mode='full'|'same'|'valid'): Use FullLength, SameAsSignal, or NoPadding respectively.
- SciPy scipy.signal.convolve: Similar to NumPy with additional boundary modes via SignalPadding.
- OpenCV cv2.filter2D: Typically uses Centered with Replicate.