TVec::CrossCorr Method

TVec *CrossCorr(TVec *Vec1, TVec *Vec2, int HiLag, int LoLag, TCorrNorm CorrelationNorm = TCorrNorm::cnDefault, TVecInt *Buffer = null);

The cross-correlation of two vectors.

#NameTypeDescription
1Vec1TVec *
2Vec2TVec *
3HiLagint
4LoLagint
5CorrelationNorm = TCorrNorm::cnDefaultTCorrNorm
6Buffer = nullTVecInt *
Remarks:

Calculate the cross-correlation of two vectors Vec1 and Vec2. The parameter HiLag indicates the top of the range of lags at which the correlation estimates should be computed. The parameter LoLag indicates the bottom of the range of lags at which the correlation estimates should be computed. The results are stored in calling vector. The resulting elements are defined by the equation:

V[n]=k=0Vec1.Length1Vec1[k]Vec2[n+k+LoLag],0nHiLagLoLagVec2[k]={Vec2[k]0k<Vec2.Length0otherwise\begin{aligned} \text{V}[n] &= \sum _{k=0} ^{\text{Vec1.Length}-1} \text{Vec1}[k] \text{Vec2}[n+k+\text{LoLag}], \quad 0\leq n \leq \text{HiLag}-\text{LoLag} \\ \text{Vec2}[k] &= \begin{cases} \text{Vec2}[k] & 0\leq k < \text{Vec2.Length}\\ 0 & \text{otherwise}\end{cases} \end{aligned}

The Buffer parameter allows the same work memory to be used between consecutive calls to this and other functions. The Buffer object will not be resized, if sufficient memory is present.

See Also: TVec::AutoCorrBiased, TVec::AutoCorrNormal, TVec::AutoCorrUnBiased
Declared in Dew::Math::TVec · Dew.Math/MtxVec.h · Cross-compiler