Click or drag to resize

Double1DCorrelation Class

Double1DCorrelation represents a 1D correlation, with a specified kernel and data length.
Inheritance Hierarchy
SystemObject
  CenterSpace.NMath.CoreCorrelationBase
    CenterSpace.NMath.CoreDouble1DCorrelation

Namespace: CenterSpace.NMath.Core
Assembly: NMath (in NMath.dll) Version: 7.4
Syntax
[SerializableAttribute]
public class Double1DCorrelation : CorrelationBase, 
	ICloneable

The Double1DCorrelation type exposes the following members.

Constructors
 NameDescription
Public methodDouble1DCorrelation(Double, Int32) Constructs a correlation instance and defines the correlation kernel, and input signal data length.
Public methodDouble1DCorrelation(DoubleVector, Int32) Constructs a correlation instance and defines the correlation kernel, and input signal data length.
Public methodDouble1DCorrelation(Double, Int32, Int32, Int32) Constructs a correlation instance and defines the correlation kernel with a given offset and stride.
Top
Properties
 NameDescription
Public propertyDataLength Gets the length of the correlation data.
(Inherited from CorrelationBase)
Public propertyKernelLength Gets the length of the correlation kernel.
(Inherited from CorrelationBase)
Public propertyKernelShape Gets the shape of the convolution kernel.
(Inherited from CorrelationBase)
Public propertyLength Gets the length of the correlation.
(Inherited from CorrelationBase)
Top
Methods
 NameDescription
Public methodClone Creates a deep copy of this correlation instance.
Public methodCorrelate(Double) Computes the correlation between the stored correlation kernel, and the vector data.
Public methodCorrelate(DoubleVector) Computes the correlation between the stored correlation kernel, and the vector data.
Public methodCorrelate(Double, Double) Computes the correlation between the stored correlation kernel, and the vector data.
Public methodCorrelate(DoubleVector, DoubleVector) Computes the correlation between the stored correlation kernel, and the vector data.
Public methodDispose Clean up resources.
(Inherited from CorrelationBase)
Protected methodFinalize Provides non-deterministic destruction of underlying unmanaged resources.
(Inherited from CorrelationBase)
Public methodTrimConvolution Creates a clipped view into the correlation. This does not create a copy of the input correlation.
Protected methodTrimCorrelationT Creates a windowed view into the correlation. This does not create a copy of the input correlation.
(Inherited from CorrelationBase)
Top
Fields
 NameDescription
Protected fieldkerneloffset_ Offset into correlation kernel.
(Inherited from CorrelationBase)
Protected fieldkernelstride_ Correlation kernel stride.
(Inherited from CorrelationBase)
Protected fieldmode_ Mode is either automatic, fft, or direct sum.
(Inherited from CorrelationBase)
Top
Remarks
The length of the correlation = length_of_data + length_of_kernel - 1. In general, unlike convolution, correlation is a non-communitive operation. Typically the kernel is shorter than the data and is used over many correlations operations against different data sets. This class is designed to be used in that fashion and the higest performance will be acheived if the kernel is fixed over a series of correlation operations.
Example
C#
DoubleVector kernel = new DoubleVector(1, 2, 3, 1);
DoubleVector data = new DoubleVector(1, 2, 3, 4, 5, 6);

Double1DCorrelation corr = new Double1DCorrelation(kernel, data.Length);
DoubleVector correlation = corr.Correlate(data);

DoubleVector corr_full_kernel_overlap = corr.TrimConvolution(correlation, CorrelationBase.Windowing.FullKernelOverlap);
DoubleVector corr_centered = corr.TrimConvolution(correlation, CorrelationBase.Windowing.CenterWindow);

// correlation =            [1 5 11 18 25 32 32 17 6]
// corr_centered =              [11 18 25 32 32 17]
// corr_full_kernel_overlap =      [18 25 32]
See Also