TVec.AutoCorrUnBiased Method

TVec AutoCorrUnBiased(TVec Vec, Int32 Lags, TVecInt Buffer)

Unbiased auto-correlation.

#NameTypeDescription
1VecTVecsource TVec
2LagsInt32
3BufferTVecIntsource TVecInt

Result: stored in self (calling object), returns self for chaining

Remarks:

Calculate the unbiased auto-correlation of the vector Vec. The result of Length = Lags is stored in the calling vector (V). The Lags parameter must be equal or smaller than the calling vector (V) length. The unbiased auto-correlation is defined by the following equation:

V[k]=1Lengthnk=0Length1Vec[k]Vec[k+n],where 0kLagsVec[k]={Vec[k]0kLength0otherwise\begin{aligned} \text{V}[k] &= \frac{1}{\text{Length}-|n|} \sum _{k=0} ^{\text{Length}-1} \text{Vec}[k] \cdot \text{Vec}[k+n] ,\quad \text{where } 0 \leq k \leq \text{Lags} \\ \text{Vec}[k] &= \begin{cases} \text{Vec}[k] & 0\leq k \leq \text{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.

Examples
using Dew.Math;
using Dew.Math.Units;

namespace Dew.Examples
{
    void Example()
    {
        TVec a,b;
        MtxVec.CreateIt(out a, aut b);
        try
        {
            a.SetIt(false, new double[] {1,2,3,4});
            b.AutoCorrUnBiased(a,2);
        }
        finally
        {
            MtxVec.FreeIt(ref a, ref b);
        }
    }
}
See Also: TVec.AutoCorrBiased, TVec.AutoCorrNormal