SignalMath.Convolve Method

Definition

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

Overload List

Convolve<T>(Vector<T>, Vector<T>, ConvolutionMode) Computes the convolution of two real-valued vectors and returns the result.
Convolve<T>(Vector<Complex<T>>, Vector<Complex<T>>, ConvolutionMode) Computes the convolution of two complex-valued vectors and returns the result.
Convolve<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, Span<T>, ConvolutionMode) Computes the convolution of two real signals.
Convolve<T>(ReadOnlySpan<Complex<T>>, ReadOnlySpan<Complex<T>>, Span<Complex<T>>, ConvolutionMode) Computes the convolution of two complex signals.
Convolve<T>(Vector<T>, Vector<T>, Vector<T>, ConvolutionMode) Computes the convolution of two real-valued vectors.
Convolve<T>(Vector<Complex<T>>, Vector<Complex<T>>, Vector<Complex<T>>, ConvolutionMode) Computes the convolution of two complex-valued vectors.
Convolve<T>(Int32, ReadOnlySpan<T>, Int32, Int32, ReadOnlySpan<T>, Int32, Int32, Span<T>, Int32, ConvolutionMode) Computes the convolution of two real signals.
Convolve<T>(Int32, ReadOnlySpan<Complex<T>>, Int32, Int32, ReadOnlySpan<Complex<T>>, Int32, Int32, Span<Complex<T>>, Int32, ConvolutionMode) Computes the convolution of two complex signals.

Convolve<T>(Vector<T>, Vector<T>, ConvolutionMode)

Computes the convolution of two real-valued vectors and returns the result.
C#
public static Vector<T> Convolve<T>(
	Vector<T> signal,
	Vector<T> kernel,
	ConvolutionMode shape = ConvolutionMode.FullLength
)

Parameters

signal  Vector<T>
The input signal vector.
kernel  Vector<T>
The convolution kernel vector.
shape  ConvolutionMode  (Optional)
The output shape mode.

Type Parameters

T
The element type (double or float).

Return Value

Vector<T>
A vector containing the convolution result.

Exceptions

ArgumentNullException Thrown when signal or kernel is null.

Convolve<T>(Vector<Complex<T>>, Vector<Complex<T>>, ConvolutionMode)

Computes the convolution of two complex-valued vectors and returns the result.
C#
public static Vector<Complex<T>> Convolve<T>(
	Vector<Complex<T>> signal,
	Vector<Complex<T>> kernel,
	ConvolutionMode shape = ConvolutionMode.FullLength
)

Parameters

signal  Vector<Complex<T>>
The input signal vector.
kernel  Vector<Complex<T>>
The convolution kernel vector.
shape  ConvolutionMode  (Optional)
The output shape mode.

Type Parameters

T
The element type (double or float).

Return Value

Vector<Complex<T>>
A vector containing the convolution result.

Exceptions

ArgumentNullException Thrown when signal or kernel is null.

Convolve<T>(ReadOnlySpan<T>, ReadOnlySpan<T>, Span<T>, ConvolutionMode)

Computes the convolution of two real signals.
C#
public static void Convolve<T>(
	ReadOnlySpan<T> signal,
	ReadOnlySpan<T> kernel,
	Span<T> result,
	ConvolutionMode shape = ConvolutionMode.FullLength
)

Parameters

signal  ReadOnlySpan<T>
The input signal.
kernel  ReadOnlySpan<T>
The convolution kernel.
result  Span<T>
The output span to hold the convolution result.
shape  ConvolutionMode  (Optional)
The output shape mode.

Type Parameters

T
The element type (double or float).

Exceptions

ArgumentException Thrown when the result span is too small for the requested output shape.

Convolve<T>(ReadOnlySpan<Complex<T>>, ReadOnlySpan<Complex<T>>, Span<Complex<T>>, ConvolutionMode)

Computes the convolution of two complex signals.
C#
public static void Convolve<T>(
	ReadOnlySpan<Complex<T>> signal,
	ReadOnlySpan<Complex<T>> kernel,
	Span<Complex<T>> result,
	ConvolutionMode shape = ConvolutionMode.FullLength
)

Parameters

signal  ReadOnlySpan<Complex<T>>
The input signal.
kernel  ReadOnlySpan<Complex<T>>
The convolution kernel.
result  Span<Complex<T>>
The output span to hold the convolution result.
shape  ConvolutionMode  (Optional)
The output shape mode.

Type Parameters

T
The element type (double or float).

Exceptions

ArgumentException Thrown when the result span is too small for the requested output shape.

Convolve<T>(Vector<T>, Vector<T>, Vector<T>, ConvolutionMode)

Computes the convolution of two real-valued vectors.
C#
public static void Convolve<T>(
	Vector<T> signal,
	Vector<T> kernel,
	Vector<T> output,
	ConvolutionMode shape = ConvolutionMode.FullLength
)

Parameters

signal  Vector<T>
The input signal vector.
kernel  Vector<T>
The convolution kernel vector.
output  Vector<T>
The output vector to hold the convolution result.
shape  ConvolutionMode  (Optional)
The output shape mode.

Type Parameters

T
The element type (double or float).

Exceptions

ArgumentNullException Thrown when signal, kernel, or output is null.
ArgumentException Thrown when the output vector length does not match the expected size for the given shape.

Convolve<T>(Vector<Complex<T>>, Vector<Complex<T>>, Vector<Complex<T>>, ConvolutionMode)

Computes the convolution of two complex-valued vectors.
C#
public static void Convolve<T>(
	Vector<Complex<T>> signal,
	Vector<Complex<T>> kernel,
	Vector<Complex<T>> output,
	ConvolutionMode shape = ConvolutionMode.FullLength
)

Parameters

signal  Vector<Complex<T>>
The input signal vector.
kernel  Vector<Complex<T>>
The convolution kernel vector.
output  Vector<Complex<T>>
The output vector to hold the convolution result.
shape  ConvolutionMode  (Optional)
The output shape mode.

Type Parameters

T
The element type (double or float).

Exceptions

ArgumentNullException Thrown when signal, kernel, or output is null.
ArgumentException Thrown when the output vector length does not match the expected size for the given shape.

Convolve<T>(Int32, ReadOnlySpan<T>, Int32, Int32, ReadOnlySpan<T>, Int32, Int32, Span<T>, Int32, ConvolutionMode)

Computes the convolution of two real signals.
C#
public static void Convolve<T>(
	int signalLength,
	ReadOnlySpan<T> signal,
	int signalStride,
	int kernelLength,
	ReadOnlySpan<T> kernel,
	int kernelStride,
	int resultLength,
	Span<T> result,
	int resultStride,
	ConvolutionMode shape = ConvolutionMode.FullLength
)

Parameters

signalLength  Int32
The number of elements in the signal.
signal  ReadOnlySpan<T>
The input signal.
signalStride  Int32
The stride between successive elements in signal.
kernelLength  Int32
The number of elements in the kernel.
kernel  ReadOnlySpan<T>
The convolution kernel.
kernelStride  Int32
The stride between successive elements in kernel.
resultLength  Int32
The number of elements in the result.
result  Span<T>
The output span to hold the convolution result.
resultStride  Int32
The stride between successive elements in result.
shape  ConvolutionMode  (Optional)
The output shape mode.

Type Parameters

T
The element type (double or float).

Exceptions

ArgumentException Thrown when the result span is too small for the requested output shape.

Convolve<T>(Int32, ReadOnlySpan<Complex<T>>, Int32, Int32, ReadOnlySpan<Complex<T>>, Int32, Int32, Span<Complex<T>>, Int32, ConvolutionMode)

Computes the convolution of two complex signals.
C#
public static void Convolve<T>(
	int signalLength,
	ReadOnlySpan<Complex<T>> signal,
	int signalStride,
	int kernelLength,
	ReadOnlySpan<Complex<T>> kernel,
	int kernelStride,
	int resultLength,
	Span<Complex<T>> result,
	int resultStride,
	ConvolutionMode shape = ConvolutionMode.FullLength
)

Parameters

signalLength  Int32
The number of elements in the signal.
signal  ReadOnlySpan<Complex<T>>
The input signal.
signalStride  Int32
The stride between successive elements in signal.
kernelLength  Int32
The number of elements in the kernel.
kernel  ReadOnlySpan<Complex<T>>
The convolution kernel.
kernelStride  Int32
The stride between successive elements in kernel.
resultLength  Int32
The number of elements in the result.
result  Span<Complex<T>>
The output span to hold the convolution result.
resultStride  Int32
The stride between successive elements in result.
shape  ConvolutionMode  (Optional)
The output shape mode.

Type Parameters

T
The element type (double or float).

Exceptions

ArgumentException Thrown when the result span is too small for the requested output shape.

See Also