|Syntax C/C++||#include <MFstd.h>|
void MF_xcorr( fMatrix MC, fMatrix MA, fMatrix MB, ui ht, ui len );
|C++ MatObj||#include <OptiVec.h>|
void matrix<T>::xcorr( const matrix<T>& MA, const matrix<T>& MB );
procedure MF_xcorr( MC, MA, MB:fMatrix; ht, len:UIntSize );
|Description||The spatial cross-correlation function (SCCF) of MA and MB is calculated and stored in MC in wrap-around order in both dimensions: The row elements MCi,0 to MCi,len/2-1 contain the SCCF for zero and positive x lags. Beginning with the most negative lag in MCi,len/2+1, the elements up to MCi,len-1 contain the SCCF for negative lags. Since this function assumes MA and MB to be periodic, the SCCF for the most positive lag is identical to the SCCF for the most negative lag. This element is stored as MCi,len/2.
Similarly, the column elements MC0,j to MClen/2-1,j contain the SCCF for zero and positive y lags. Beginning with the most negative lag in MClen/2+1,j, the elements up to MClen-1,j contain the SCCF for negative lags.
To get the SCCF into normal order, you may call
MF_Rows_rotate( MC, ht, len, len/2 );
MF_Cols_rotate( MC, ht, len, ht/2 );
After that, the zero point is at the position MCht/2,len/2.
In case MA or MB are non-periodic, you should avoid end effects by the methods described in connection with MF_convolve.
All three matrices involved have the same dimensions. Both ht and len must be integer powers of 2.
About special versions with the prefixes MFl_ and MFs_, consult chapter 4.8 of http://www.optivec.com/vecfuncs/.