
Function  Crosscorrelation function of two vectors. 

Syntax C/C++  #include <VFstd.h>
void VF_xcorr( fVector Z, fVector X, fVector Y, ui size ); 
C++ VecObj  #include <OptiVec.h>
void vector<T>::xcorr( const vector<T>& X, const vector<T>& Y ); 
Pascal/Delphi  uses VFstd;
procedure VF_xcorr( Z, X, Y:fVector; size:UIntSize ); 

Description  The crosscorrelation function (CCF) of X and Y is calculated and stored in Z in wraparound order: Z_{0} to Z_{size/21} contain the CCF for zero and positive lags. Beginning with the most negative lag in Z_{size/2+1}, the elements up to Z_{size1} contain the CCF for negative lags. Since this function assumes X to be periodic, the CCF for the most positive lag is identical to the CCF for the most negative lag. This element is stored as Z_{size/2}.
To get the CCF into normal order, you may call
VF_rotate( Z, Z, size, size/2 );
After that, the zero point is at the position size/2.
In case X is nonperiodic, end effects should be avoided by the methods described in connection with VF_convolve.


Error handling  If size is not a power of 2, VF_FFT (on which VF_xcorr is based) complains "Size must be an integer power of 2" and the program is aborted. 


