KernelProcessor<T>.FromKernel Method

Definition

Namespace: Numerics.NET.SignalProcessing
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.0.0

Overload List

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.

FromKernel(Complex<T>[], ConvolutionMode, Int32)

Creates a kernel processor for complex-valued kernels with default anchor and padding.
C#
public static ComplexKernelProcessor<T> FromKernel(
	Complex<T>[] kernel,
	ConvolutionMode mode = ConvolutionMode.FullLength,
	int fftThreshold = 256
)

Parameters

kernel  Complex<T>[]
The complex convolution kernel. Must not be null or empty.
mode  ConvolutionMode  (Optional)
The output mode that determines the size and alignment of the result. Default is FullLength.
fftThreshold  Int32  (Optional)
The threshold for switching to FFT-based implementation when using Auto. Default is 256.

Return Value

ComplexKernelProcessor<T>
A new ComplexKernelProcessor<T> instance with default anchor (Default), zero padding (Zero), and auto processing method.

Exceptions

ArgumentNullExceptionkernel is null.

FromKernel(T[], ConvolutionMode, Int32)

Creates a kernel processor for real-valued kernels with default anchor and padding.
C#
public static RealKernelProcessor<T> FromKernel(
	T[] kernel,
	ConvolutionMode mode = ConvolutionMode.FullLength,
	int fftThreshold = 256
)

Parameters

kernel  T[]
The convolution kernel. Must not be null or empty.
mode  ConvolutionMode  (Optional)
The output mode that determines the size and alignment of the result. Default is FullLength.
fftThreshold  Int32  (Optional)
The threshold for switching to FFT-based implementation when using Auto. Default is 256.

Return Value

RealKernelProcessor<T>
A new RealKernelProcessor<T> instance with default anchor (Default), zero padding (Zero), and auto processing method.

Remarks

This overload is convenient for simple use cases matching NumPy's np.convolve behavior.

Exceptions

ArgumentNullExceptionkernel is null.

FromKernel(Complex<T>[], KernelAnchor, ConvolutionMode, SignalPadding, KernelProcessingMethod, Int32)

Creates a kernel processor for complex-valued kernels.
C#
public static ComplexKernelProcessor<T> FromKernel(
	Complex<T>[] kernel,
	KernelAnchor anchor = default,
	ConvolutionMode mode = ConvolutionMode.FullLength,
	SignalPadding padding = SignalPadding.Zero,
	KernelProcessingMethod processingMethod = KernelProcessingMethod.Auto,
	int fftThreshold = 256
)

Parameters

kernel  Complex<T>[]
The complex convolution kernel. Must not be null or empty.
anchor  KernelAnchor  (Optional)
The anchor point of the kernel. Determines which kernel element aligns with the current signal sample. Default is Default, which adapts based on mode.
mode  ConvolutionMode  (Optional)
The output mode that determines the size and alignment of the result. Default is FullLength, returning output of length signalLength + kernelLength - 1.
padding  SignalPadding  (Optional)
The signal padding mode used for boundary extension. Default is Zero, padding with zeros outside the signal boundaries.
processingMethod  KernelProcessingMethod  (Optional)
The processing method selection strategy. Default is Auto, automatically choosing between direct and FFT methods.
fftThreshold  Int32  (Optional)
The threshold for switching to FFT-based implementation when using Auto. FFT is used when signalLength * kernelLength > fftThreshold. Default is 256.

Return Value

ComplexKernelProcessor<T>
A new ComplexKernelProcessor<T> instance.

Remarks

Complex convolution preserves the full complex arithmetic. For correlation, the kernel is conjugated element-wise.

Exceptions

ArgumentNullExceptionkernel is null.

FromKernel(T[], KernelAnchor, ConvolutionMode, SignalPadding, KernelProcessingMethod, Int32)

Creates a kernel processor for real-valued kernels.
C#
public static RealKernelProcessor<T> FromKernel(
	T[] kernel,
	KernelAnchor anchor = default,
	ConvolutionMode mode = ConvolutionMode.FullLength,
	SignalPadding padding = SignalPadding.Zero,
	KernelProcessingMethod processingMethod = KernelProcessingMethod.Auto,
	int fftThreshold = 256
)

Parameters

kernel  T[]
The convolution kernel. Must not be null or empty.
anchor  KernelAnchor  (Optional)
The anchor point of the kernel. Determines which kernel element aligns with the current signal sample. Default is Default, which adapts based on mode.
mode  ConvolutionMode  (Optional)
The output mode that determines the size and alignment of the result. Default is FullLength, returning output of length signalLength + kernelLength - 1.
padding  SignalPadding  (Optional)
The signal padding mode used for boundary extension. Default is Zero, padding with zeros outside the signal boundaries.
processingMethod  KernelProcessingMethod  (Optional)
The processing method selection strategy. Default is Auto, automatically choosing between direct and FFT methods.
fftThreshold  Int32  (Optional)
The threshold for switching to FFT-based implementation when using Auto. FFT is used when signalLength * kernelLength > fftThreshold. Default is 256.

Return Value

RealKernelProcessor<T>
A new RealKernelProcessor<T> instance.

Remarks

The anchor and mode interact to determine the alignment of the output:

  • With FullLength and Default, output[0] corresponds to the first possible overlap (kernel end aligned with signal start).
  • With SameAsSignal and Default, output has the same length as the signal with the kernel centered on each sample.
  • With NoPadding and Default, only positions with complete kernel overlap are computed.

Exceptions

ArgumentNullExceptionkernel is null.

See Also