MF_xspectrum
| MD_xspectrum |
ME_xspectrum |
MF_xspectrumAbs
| MD_xspectrumAbs |
ME_xspectrumAbs |
MFb_xspectrum
| MDb_xspectrum |
MEb_xspectrum |
MFb_xspectrumAbs
| MDb_xspectrumAbs |
MEb_xspectrumAbs |
MFb_xspectrum_sizeBuf
| MDb_xspectrum_sizeBuf |
MEb_xspectrum_sizeBuf |
MFb_xspectrumAbs_sizeBuf
| MDb_xspectrumAbs_sizeBuf |
MEb_xspectrumAbs_sizeBuf |
|
Function | spatial frequency cross spectrum |
|
Syntax C/C++ | #include <MFstd.h>
void MF_xspectrum( cfMatrix MSpec, ui htSpec, ui lenSpec, fMatrix MX, fMatrix MY, ui htX, ui lenX, fMatrix Win );
void MFb_xspectrum( cfMatrix MSpec, ui htSpec, ui lenSpec, fMatrix MX, fMatrix MY, ui htX, ui lenX, fMatrix Win, fVector Buf );
ui MFb_xspectrum_sizeBuf( ui htSpec, ui lenSpec, ui htX, ui lenX );
void MF_xspectrumAbs( fMatrix MSpec, ui htSpec, ui lenSpec, fMatrix MX, fMatrix MY, ui htX, ui lenX, fMatrix Win );
void MFb_xspectrumAbs( fMatrix MSpec, ui htSpec, ui lenSpec, fMatrix MX, ui htX, fMatrix MY, ui lenX, fMatrix Win, fVector Buf );
ui MFb_xspectrumAbs_sizeBuf( ui htSpec, ui lenSpec, ui htX, ui lenX ); |
C++ MatObj | #include <OptiVec.h>
void matrix<complex<T>>::xspectrum( const matrix<T>& MX, const matrix<T>& MY, const matrix<T>& MWin );
void matrix<complex<T>>::b_xspectrum( const matrix<T>& MX, const matrix<T>& MY, const matrix<T>& MWin, vector<T> Buf );
void matrix<T>::xspectrumAbs( const matrix<T>& MX, const matrix<T>& MY, const matrix<T>& MWin );
void matrix<T>::b_xspectrumAbs( const matrix<T>& MX, const matrix<T>& MY, const matrix<T>& MWin, vector<T> Buf ); |
Pascal/Delphi | uses MFstd;
procedure MF_xspectrum( MSpec:cfMatrix; htSpec, lenSpec:UIntSize; MX, MY:fMatrix; htX, lenX:UIntSize; MWin:fMatrix );
procedure MFb_xspectrum( MSpec:cfMatrix; htSpec, lenSpec:UIntSize; MX, MY:fMatrix; htX, lenX:UIntSize; MWin:fMatrix; Buf:fVector );
function MFb_xspectrum_sizeBuf( htSpec, lenSpec, htX, lenX:UIntSize ): UIntSize;
procedure MF_xspectrumAbs( MSpec:fMatrix; htSpec, lenSpec:UIntSize; MX, MY:fMatrix; htX, lenX:UIntSize; MWin:fMatrix );
procedure MFb_xspectrumAbs( MSpec:fMatrix; htSpec, lenSpec:UIntSize; MX, MY:fMatrix; htX, lenX:UIntSize; MWin:fMatrix; Buf:fVector );
function MFb_xspectrumAbs_sizeBuf( htSpec, lenSpec, htX, lenX:UIntSize ): UIntSize; |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_xspectrum( cfMatrix d_Spec, ui htSpec, ui lenSpec, fMatrix d_X, fMatrix d_Y, ui htX, ui lenX, fMatrix d_Win );
void MFcu_xspectrum( cfMatrix h_Spec, ui htSpec, ui lenSpec, fMatrix h_X, fMatrix h_Y, ui htX, ui lenX, fMatrix h_Win );
int cudaMF_xspectrumAbs( fMatrix d_Spec, ui htSpec, ui lenSpec, fMatrix d_X, fMatrix d_Y, ui htX, ui lenX, fMatrix d_Win );
void MFcu_xspectrumAbs( fMatrix h_Spec, ui htSpec, ui lenSpec, fMatrix h_X, fMatrix h_Y, ui htX, ui lenX, fMatrix h_Win );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_xspectrum( d_MSpec:cfMatrix; htSpec, lenSpec:UIntSize; d_MX, d_MY:fMatrix; htX, lenX:UIntSize; d_MWin:fMatrix ): IntBool;
procedure MFcu_xspectrum( h_MSpec:cfMatrix; htSpec, lenSpec:UIntSize; h_MX, h_MY:fMatrix; htX, lenX:UIntSize; h_MWin:fMatrix );
function cudaMF_xspectrumAbs( d_MSpec:fMatrix; htSpec, lenSpec:UIntSize; d_MX, d_MY:fMatrix; htX, lenX:UIntSize; d_MWin:fMatrix ): IntBool;
procedure MFcu_xspectrumAbs( h_MSpec:fMatrix; htSpec, lenSpec:UIntSize; h_MX, h_MY:fMatrix; htX, lenX:UIntSize; h_MWin:fMatrix );
|
|
Description | The cross spectrum of the two matrices MX and MY is calculated and stored in MSpc.
MF_xspectrum stores the complex cross spectrum (i.e., including phase information), whereas MF_xspectrumAbs covers the more frequent case that only the absolute values are of interest.
The algorithm follows Welch's method of dividing the input data into overlapping segments, similarly to the one-dimensional case described for VF_xspectrum.
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_xspectrum / MF_xspectrumAbs allocates and frees additional workspace memory. For repeated calls, this would be inefficient. In such a case, it is recommended to use MFb_xspectrum / MFb_xspectrumAbs instead. The necessary size of Buf can be obtained by calling the function MFb_xspectrum_sizeBuf / MFb_xspectrumAbs_sizeBuf. It will never need to be more than 7*htX*lenX for MFb_xspectrum and 8*htX*lenX for MFb_xspectrumAbs. 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 handling | If either htSpec or lenSpec is not a power of 2, VF_FFT (on which MF_xspectrum relies) complains "Size must be an integer power of 2" and the program is aborted. If MSpc overwrites MX, MY, or MWin, an error message "Vectors/matrices must not be identical" is generated and the program aborted. |
|
|