20 fFFTW_Forward_Plan=NULL;
21 fFFTW_Backward_Plan=NULL;
29 "Package mathtools not compiled with FFTW3 support!");
38 fFFTW_Forward_Plan=NULL;
39 fFFTW_Backward_Plan=NULL;
48 "Package mathtools not compiled with FFTW3 support!");
59 if(!
Resize(origData.Size()))
71 if(fFFTW_Forward_Plan==NULL)
77 for(
size_t i=0;i<
fSize;i++)
81 for(
size_t i=0;i<
fSize;i++)
86 fftw_execute(fFFTW_Forward_Plan);
92 for(
size_t i=0;i<
fSize/2+1;i++){
93 Re[i]=fComplexData[i][0];
94 Im[i]=fComplexData[i][1];
98 for(
size_t i=0;i<
fSize/2-1;i++){
105 "Package mathtools not compiled with FFTW3 support!");
115 ret =
Resize(2*(origFT.Size()-1));
117 ret =
Resize(origFT.Size());
130 if(fFFTW_Backward_Plan==NULL)
137 const QVector &
Re=origFT.Re();
138 const QVector &
Im=origFT.Im();
139 for(
size_t i=0;i<
fSize/2+1;i++){
140 fComplexData[i][0]=
Re[i];
141 fComplexData[i][1]=
Im[i];
144 fftw_execute(fFFTW_Backward_Plan);
147 for(
size_t i=0;i<
fSize;i++)
151 for(
size_t i=0;i<
fSize;i++)
157 "Package mathtools not compiled with FFTW3 support!");
168 fFFTW_Forward_Plan=fftw_plan_dft_r2c_1d(
fSize,
fData,fComplexData,
170 if(fFFTW_Forward_Plan==NULL)
174 fFFTW_Backward_Plan=fftw_plan_dft_c2r_1d(
fSize,fComplexData,
fData,
176 if(fFFTW_Backward_Plan==NULL)
209 if(
fSize==size)
return true;
242 if(clearMem &&
fData){
248 if(fFFTW_Forward_Plan){
249 fftw_destroy_plan(fFFTW_Forward_Plan);
250 fFFTW_Forward_Plan=NULL;
252 if(fFFTW_Backward_Plan){
253 fftw_destroy_plan(fFFTW_Backward_Plan);
254 fFFTW_Backward_Plan=NULL;
263 size_t wsize = tmp.Size();
double Im(const Diana::QComplex &z)
Function to get the imag part.
double Re(const Diana::QComplex &z)
Function to get the real part.
#define Q_BEGIN_NAMESPACE
ClassImp(Diana::QRealComplexFFTW3)
error class with error type and description
Interface for ffts in Diana analysis.
void SetForward(bool isForward)
virtual method. Must be implemented by daughter classes set the direction of the transform.
static QVector GetWindow(WindowType wt, size_t size, size_t zeros=0, int coherent=0, int param=0)
create window and add zeros/2 to the left and zeros/2 to the right
virtual bool ClearCache(bool clearMem=true)
Free the allocated memory.
bool Resize(size_t s)
Resize the allocated memory.
size_t fAllocatedSize
Size of the allocated array.
virtual ~QRealComplexFFTW3()
destructor
virtual void SetWindowType(WindowType wt, int coherent=0)
resize working table and space
virtual bool CreatePlan(bool Forward)
Create a plan for this FFT (or any of this size)
virtual int Transform(const QVector &data, QVector &result)
Perform the transformation.
virtual int TransformFromFreq(const QVectorC &FT, QVector &spectrum, bool compress=false)
transform from the frequencies to the times
QRealComplexFFTW3()
empty constructor
bool fSizeLock
Lock the FFT size.
virtual int TransformToFreq(const QVector &data, QVectorC &FFT, bool compress=false)
transform from the times to the frequencies
static void ArrayFree(double *array)
static double * ArrayAlloc(const UInt_t size)