Real Kernel Processor<T>.Correlate 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
| Correlate( | Computes the cross-correlation of a vector with the stored kernel (allocating). |
| Correlate( | Computes the cross-correlation of a signal with the stored kernel. |
| Correlate( | Computes the cross-correlation of a vector with the stored kernel (non-allocating). |
| Correlate( | Computes the cross-correlation of a real signal with the stored kernel. |
Correlate(Int32, ReadOnlySpan<T>, Int32, Int32, Span<T>, Int32)
Computes the cross-correlation of a real signal with the stored kernel.
public override void Correlate(
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 correlation 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 correlation computes: y[n] = Σ_m x[n - (m - a)] · h[m] with a time-reversed kernel. For real-valued signals, this is equivalent to convolving with the time-reversed kernel. This operation is commonly used for template matching and signal similarity measurement.
The kernel reversal is handled internally and efficiently - the kernel array is not actually reversed in memory. The implementation uses optimized algorithms that account for the reversal during computation.
Comparison with other libraries:
- NumPy np.correlate(signal, kernel, mode): Use the corresponding ConvolutionMode value.
- SciPy scipy.signal.correlate: Similar behavior with support for different boundary modes.