71 fIn = fftw_malloc(
sizeof(fftw_complex)*(n/2+1));
72 fOut = fftw_malloc(
sizeof(Double_t)*n);
75 fIn = fftw_malloc(
sizeof(fftw_complex)*(n/2+1));
94 for (Int_t i=0; i<
fNdim; i++){
98 Int_t sizein = Int_t(Double_t(
fTotalSize)*(n[ndim-1]/2+1)/n[ndim-1]);
100 fIn = fftw_malloc(
sizeof(fftw_complex)*sizein);
103 fIn = fftw_malloc(
sizeof(fftw_complex)*sizein);
117 fftw_destroy_plan((fftw_plan)
fPlan);
119 fftw_free((fftw_complex*)
fIn);
151 fftw_destroy_plan((fftw_plan)
fPlan);
157 fPlan = (
void*)fftw_plan_dft_c2r(
fNdim,
fN, (fftw_complex*)
fIn, (Double_t*)
fIn,
MapFlag(flags));
166 fftw_execute((fftw_plan)
fPlan);
168 Error(
"Transform",
"transform was not initialized");
180 Error(
"GetPoints",
"Input array has been destroyed");
183 const Double_t * array = (
const Double_t*) ( (
fOut) ?
fOut :
fIn );
194 Error(
"GetPointReal",
"Input array has been destroyed");
197 const Double_t * array = (
const Double_t*) ( (
fOut) ?
fOut :
fIn );
198 return array[ipoint];
208 Error(
"GetPointReal",
"Input array has been destroyed");
211 Int_t ireal = ipoint[0];
212 for (Int_t i=0; i<
fNdim-1; i++)
213 ireal=
fN[i+1]*ireal + ipoint[i+1];
215 const Double_t * array = (
const Double_t*) ( (
fOut) ?
fOut :
fIn );
226 Error(
"GetPointComplex",
"Input array has been destroyed");
229 const Double_t * array = (
const Double_t*) ( (
fOut) ?
fOut :
fIn );
241 Error(
"GetPointComplex",
"Input array has been destroyed");
244 const Double_t * array = (
const Double_t*) ( (
fOut) ?
fOut :
fIn );
246 Int_t ireal = ipoint[0];
247 for (Int_t i=0; i<
fNdim-1; i++)
248 ireal=
fN[i+1]*ireal + ipoint[i+1];
264 Error(
"GetPointsReal",
"Input array was destroyed");
277 Error(
"GetPointsComplex",
"Input array has been destroyed");
280 const Double_t * array = (
const Double_t*) ( (
fOut) ?
fOut :
fIn );
294 Error(
"GetPointsComplex",
"Input array has been destroyed");
297 const Double_t * array = (
const Double_t*) ( (
fOut) ?
fOut :
fIn );
299 data[i] = array[i/2];
310 if (ipoint <=
fN[0]/2){
311 ((fftw_complex*)
fIn)[ipoint][0] = re;
312 ((fftw_complex*)
fIn)[ipoint][1] = im;
314 ((fftw_complex*)
fOut)[2*(
fN[0]/2)-ipoint][0] = re;
315 ((fftw_complex*)
fOut)[2*(
fN[0]/2)-ipoint][1] = -im;
325 Int_t ireal = ipoint[0];
326 for (Int_t i=0; i<
fNdim-2; i++){
327 ireal=
fN[i+1]*ireal + ipoint[i+1];
329 ireal = (
fN[fNdim-1]/2+1)*ireal+ipoint[fNdim-1];
330 Int_t realN = Int_t(Double_t(
fTotalSize)*(
fN[fNdim-1]/2+1)/
fN[fNdim-1]);
333 Error(
"SetPoint",
"Illegal index value");
336 ((fftw_complex*)
fIn)[ireal][0] = re;
337 ((fftw_complex*)
fIn)[ireal][1] = im;
346 if (ipoint <=
fN[0]/2){
347 ((fftw_complex*)
fIn)[ipoint][0] = c.
Re();
348 ((fftw_complex*)
fIn)[ipoint][1] = c.
Im();
350 ((fftw_complex*)
fIn)[2*(
fN[0]/2)-ipoint][0] = c.
Re();
351 ((fftw_complex*)
fIn)[2*(
fN[0]/2)-ipoint][1] = -c.
Im();
363 for (Int_t i=0; i<2*(sizein); i+=2){
364 ((fftw_complex*)
fIn)[i/2][0]=data[i];
365 ((fftw_complex*)
fIn)[i/2][1]=data[i+1];
375 for (Int_t i=0; i<sizein; i++){
376 ((fftw_complex*)
fIn)[i][0]=re[i];
377 ((fftw_complex*)
fIn)[i][1]=im[i];
392 if (opt.Contains(
"ES"))
393 return FFTW_ESTIMATE;
394 if (opt.Contains(
"M"))
396 if (opt.Contains(
"P"))
398 if (opt.Contains(
"EX"))
399 return FFTW_EXHAUSTIVE;
400 return FFTW_ESTIMATE;
virtual Double_t * GetPointsReal(Bool_t fromInput=kFALSE) const
Returns the array of computed transform Works only for output (input array is destroyed in a C2R tran...
virtual void SetPointComplex(Int_t ipoint, TComplex &c)
since the input must be complex-Hermitian, if the ipoint > n/2, the according point before n/2 is set...
virtual void Init(Option_t *flags, Int_t, const Int_t *)
Creates the fftw-plan.
virtual ~TFFTComplexReal()
Destroys the data arrays and the plan.
virtual void GetPointComplex(Int_t ipoint, Double_t &re, Double_t &im, Bool_t fromInput=kFALSE) const
Works only for output (input array is destroyed in a C2R transform)
virtual void SetPoints(const Double_t *data)
set all points.
virtual void SetPoint(Int_t ipoint, Double_t re, Double_t im=0)
since the input must be complex-Hermitian, if the ipoint > n/2, the according point before n/2 is set...
virtual void Transform()
Computes the transform, specified in Init() function.
virtual Double_t GetPointReal(Int_t ipoint, Bool_t fromInput=kFALSE) const
Returns the point #ipoint Works only for output (input array is destroyed in a C2R transform) ...
virtual void GetPointsComplex(Double_t *re, Double_t *im, Bool_t fromInput=kFALSE) const
Fills the argument array with the computed transform Works only for output (input array is destroyed ...
UInt_t MapFlag(Option_t *flag)
allowed options: "ES" - FFTW_ESTIMATE "M" - FFTW_MEASURE "P" - FFTW_PATIENT "EX" - FFTW_EXHAUSTIVE ...
virtual void SetPointsComplex(const Double_t *re, const Double_t *im)
Set all points. The values are copied.
virtual void GetPoints(Double_t *data, Bool_t fromInput=kFALSE) const
Fills the argument array with the computed transform Works only for output (input array is destroyed ...