Functionautocorrelation function
Syntax C/C++#include <VFstd.h>
void VF_autocorr( fVector Y, fVector X, ui size );
C++ VecObj#include <OptiVec.h>
void vector<float>::autocorr( const vector<float>& Y );
Pascal/Delphiuses VFstd;
procedure VF_autocorr( Y, X:fVector; size:UIntSize );
CUDA function C/C++#include <cudaVFstd.h>
int cudaVF_autocorr( fVector d_Y, fVector d_X, ui size );
void VFcu_autocorr( fVector h_Y, fVector h_X, ui size );
CUDA function Pascal/Delphiuses VFstd;
function cudaVF_autocorr( d_Y, d_X:fVector; size:UIntSize ): IntBool;
procedure VFcu_autocorr( h_Y, h_X:fVector; size:UIntSize );
DescriptionThe autocorrelation function (ACF) of X is calculated and stored in Y in wrap-around order: Y0 to Ysize/2-1 contain the ACF for zero and positive lags. Beginning with the most negative lag in Ysize/2+1, the elements up to Ysize-1 contain the ACF for negative lags. Since this function assumes X to be periodic, the ACF for the most positive lag is identical to the ACF for the most negative lag. This element is stored as Ysize/2.
To get the ACF into normal order, you may call
VF_rotate( Y, Y, size, size/2 );
After that, the zero point is at the position size/2.

In case X is non-periodic, you should avoid end effects by the methods described in connection with VF_convolve.

Error handlingIf size is not a power of 2, VF_FFT (on which VF_autocorr is based) complains "Size must be an integer power of 2" and the program is aborted.
Return valuenone
See alsoVF_FFT,   VF_convolve,   VF_xcorr,   VF_spectrum

VectorLib Table of Contents  OptiVec home