MF_coherence MD_coherence ME_coherence
MFb_coherence MDb_coherence MEb_coherence
MFb_coherence_sizeBuf MDb_coherence_sizeBuf MEb_coherence_sizeBuf
Functionspatial frequency coherence
Syntax C/C++#include <MFstd.h>
void MF_coherence( fMatrix MCohr, ui htSpec, ui lenSpec, fMatrix MX, fMatrix MY, ui htX, ui lenX, fMatrix Win );
void MFb_coherence( fMatrix MCohr, ui htSpec, ui lenSpec, fMatrix MX, fMatrix MY, ui htX, ui lenX, fMatrix Win, fVector Buf );
ui MFb_coherence_sizeBuf( ui htSpec, ui lenSpec, ui htX, ui lenX );
C++ MatObj#include <OptiVec.h>
void matrix<T>::coherence( const matrix<T>& MX, const matrix<T>& MY, const matrix<T>& MWin );
void matrix<T>::b_coherence( const matrix<T>& MX, const matrix<T>& MY, const matrix<T>& MWin, vector<T> Buf );
Pascal/Delphiuses MFstd;
procedure MF_coherence( MCohr:fMatrix; htSpec, lenSpec:UIntSize; MX, MY:fMatrix; htX, lenX:UIntSize; MWin:fMatrix );
procedure MFb_coherence( MCohr:fMatrix; htSpec, lenSpec:UIntSize; MX, MY:fMatrix; htX, lenX:UIntSize; MWin:fMatrix; Buf:fVector );
function MFb_coherence_sizeBuf( htSpec, lenSpec, htX, lenX:UIntSize ): UIntSize;
CUDA-Funktion C/C++#include <cudaMFstd.h>
int cudaMF_coherence( fMatrix d_MCohr, ui htSpec, ui lenSpec, fMatrix d_MX, fMatrix d_MY, ui htX, ui lenX, fMatrix d_MWin );
void MFcu_coherence( fMatrix h_MCohr, ui htSpec, ui lenSpec, fMatrix h_MX, fMatrix h_MY, ui htX, ui lenX, fMatrix h_MWin );
CUDA-Funktion Pascal/Delphiuses MFstd;
function cudaMF_coherence( d_MCohr:fMatrix; htSpec, lenSpec:UIntSize; d_MX, d_MY:fMatrix; htX, lenX:UIntSize; d_MWin:fMatrix ): IntBool;

procedure MFcu_coherence( h_MCohr:fMatrix; htSpec, lenSpec:UIntSize; h_MX, h_MY:fMatrix; htX, lenX:UIntSize; h_MWin:fMatrix );
DescriptionThe spatial coherence function of the data sets MX and MY is calculated and stored in MCohr.
The algorithm follows Welch's method of dividing the input data into overlapping segments and averaging over their spectra and cross-spectra. For meaningful results, there must be more than one segment (i.e., htX and lenX must be multiples of htSpec, lenSpec). For only one segment, this algorithm would yield all elements of MCohr = 1.0 (with slight round-off errors).
MWin is a window that is applied to the data segments. Three functions are available that give suitable Windows: MF_Welch,   MF_Parzen, and MF_Hann. A square window is available by setting all matrix elements equal to 1.0 (MF_equC( MWin, htSpec, lenSpec, 1.0 ); ), but this is not recommended.
htSpec and lenSpec must be integer powers of 2.
Moreover, the following conditions must be fulfilled:
htX >= n*htSpec, lenX >= n*lenSpec, htWin = htSpec, lenWin = lenSpec.

Internally, MF_coherence allocates and frees additional workspace memory. For repeated calls, this would be inefficient. In such a case, it is recommended to use MFb_coherence instead. The necessary size of Buf can be obtained by calling the function MFb_coherence_sizeBuf. It will never need to be more than 11*htX*lenX. Buf must be 128-bit (P8) or 256-bit (P9) aligned. This usually means you can only take a vector allocated by the VF_vector family as Buf.

Error handlingIf either htSpec or lenSpec is not a power of 2, VF_FFT (on which MF_coherence relies) complains "Size must be an integer power of 2" and the program is aborted.
See alsoMF_FFT,   MF_spectrum,   MF_xspectrum,   MF_convolve,   MF_autocorr,   MF_xcorr,   MF_filter,   chapter 12

MatrixLib Table of Contents  OptiVec home