SignalMath.Correlate Method

Definition

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

Overload List

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

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

Computes the cross-correlation of two real-valued vectors and returns the result.
C#
public static Vector<T> Correlate<T>(
	Vector<T> x,
	Vector<T> y,
	ConvolutionMode shape = ConvolutionMode.FullLength
)

Parameters

x  Vector<T>
The first input signal vector.
y  Vector<T>
The second input signal 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 correlation result.

Exceptions

ArgumentNullException Thrown when x or y is null.

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

Computes the cross-correlation of two complex-valued vectors and returns the result.
C#
public static Vector<Complex<T>> Correlate<T>(
	Vector<Complex<T>> x,
	Vector<Complex<T>> y,
	ConvolutionMode shape = ConvolutionMode.FullLength
)

Parameters

x  Vector<Complex<T>>
The first input signal vector.
y  Vector<Complex<T>>
The second input signal 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 correlation result.

Exceptions

ArgumentNullException Thrown when x or y is null.

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

Computes the cross-correlation of two real signals.
C#
public static void Correlate<T>(
	ReadOnlySpan<T> x,
	ReadOnlySpan<T> y,
	Span<T> result,
	ConvolutionMode shape = ConvolutionMode.FullLength
)

Parameters

x  ReadOnlySpan<T>
The first input signal.
y  ReadOnlySpan<T>
The second input signal.
result  Span<T>
The output span to hold the correlation 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.

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

Computes the cross-correlation of two complex signals.
C#
public static void Correlate<T>(
	ReadOnlySpan<Complex<T>> x,
	ReadOnlySpan<Complex<T>> y,
	Span<Complex<T>> result,
	ConvolutionMode shape = ConvolutionMode.FullLength
)

Parameters

x  ReadOnlySpan<Complex<T>>
The first input signal.
y  ReadOnlySpan<Complex<T>>
The second input signal.
result  Span<Complex<T>>
The output span to hold the correlation 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.

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

Computes the cross-correlation of two real-valued vectors.
C#
public static void Correlate<T>(
	Vector<T> x,
	Vector<T> y,
	Vector<T> output,
	ConvolutionMode shape = ConvolutionMode.FullLength
)

Parameters

x  Vector<T>
The first input signal vector.
y  Vector<T>
The second input signal vector.
output  Vector<T>
The output vector to hold the correlation result.
shape  ConvolutionMode  (Optional)
The output shape mode.

Type Parameters

T
The element type (double or float).

Exceptions

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

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

Computes the cross-correlation of two complex-valued vectors.
C#
public static void Correlate<T>(
	Vector<Complex<T>> x,
	Vector<Complex<T>> y,
	Vector<Complex<T>> output,
	ConvolutionMode shape = ConvolutionMode.FullLength
)

Parameters

x  Vector<Complex<T>>
The first input signal vector.
y  Vector<Complex<T>>
The second input signal vector.
output  Vector<Complex<T>>
The output vector to hold the correlation result.
shape  ConvolutionMode  (Optional)
The output shape mode.

Type Parameters

T
The element type (double or float).

Exceptions

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

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

Computes the cross-correlation of two real signals.
C#
public static void Correlate<T>(
	int xLength,
	ReadOnlySpan<T> x,
	int xStride,
	int yLength,
	ReadOnlySpan<T> y,
	int yStride,
	int resultLength,
	Span<T> result,
	int resultStride,
	ConvolutionMode shape = ConvolutionMode.FullLength
)

Parameters

xLength  Int32
The number of elements in the first signal.
x  ReadOnlySpan<T>
The first input signal.
xStride  Int32
The stride between successive elements in x.
yLength  Int32
The number of elements in the second signal.
y  ReadOnlySpan<T>
The second input signal.
yStride  Int32
The stride between successive elements in y.
resultLength  Int32
The number of elements in the result.
result  Span<T>
The output span to hold the correlation 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.

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

Computes the cross-correlation of two complex signals.
C#
public static void Correlate<T>(
	int xLength,
	ReadOnlySpan<Complex<T>> x,
	int xStride,
	int yLength,
	ReadOnlySpan<Complex<T>> y,
	int yStride,
	int resultLength,
	Span<Complex<T>> result,
	int resultStride,
	ConvolutionMode shape = ConvolutionMode.FullLength
)

Parameters

xLength  Int32
The number of elements in the first signal.
x  ReadOnlySpan<Complex<T>>
The first input signal.
xStride  Int32
The stride between successive elements in x.
yLength  Int32
The number of elements in the second signal.
y  ReadOnlySpan<Complex<T>>
The second input signal.
yStride  Int32
The stride between successive elements in y.
resultLength  Int32
The number of elements in the result.
result  Span<Complex<T>>
The output span to hold the correlation 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