84 fIn = fftw_malloc(
sizeof(Double_t)*n);
85 if (inPlace)
fOut = 0;
86 else fOut = fftw_malloc(
sizeof(Double_t)*n);
105 fN =
new Int_t[ndim];
108 for (Int_t i=0; i<ndim; i++){
114 fOut = fftw_malloc(
sizeof(Double_t)*fTotalSize);
124 fftw_destroy_plan((fftw_plan)
fPlan);
136 fftw_free((fftw_r2r_kind*)
fKind);
171 fftw_destroy_plan((fftw_plan)
fPlan);
175 fKind = (fftw_r2r_kind*)fftw_malloc(
sizeof(fftw_r2r_kind)*
fNdim);
192 fftw_execute((fftw_plan)
fPlan);
194 Error(
"Transform",
"transform hasn't been initialised");
205 Error(
"GetType",
"Type not defined yet (kind not set)");
208 if (((fftw_r2r_kind*)
fKind)[0]==FFTW_R2HC)
return "R2HC";
209 if (((fftw_r2r_kind*)fKind)[0]==FFTW_HC2R)
return "HC2R";
210 if (((fftw_r2r_kind*)fKind)[0]==FFTW_DHT)
return "DHT";
231 Error(
"GetPointReal",
"No such point");
235 return ( array ) ? array[ipoint] : 0;
243 Int_t ireal = ipoint[0];
244 for (Int_t i=0; i<
fNdim-1; i++)
245 ireal=
fN[i+1]*ireal + ipoint[i+1];
248 return ( array ) ? array[ireal] : 0;
258 if ( ( ((fftw_r2r_kind*)
fKind)[0]==FFTW_R2HC && !fromInput ) ||
259 ( ((fftw_r2r_kind*)fKind)[0]==FFTW_HC2R && fromInput ) )
261 if (ipoint<
fN[0]/2+1){
263 im = array[
fN[0]-ipoint];
265 re = array[
fN[0]-ipoint];
268 if ((
fN[0]%2)==0 && ipoint==
fN[0]/2) im = 0;
290 if (!fromInput &&
fOut)
291 return (Double_t*)
fOut;
292 else if (fromInput && !
fOut) {
293 Error(
"GetPointsReal",
"Input array was destroyed");
297 return (Double_t*)
fIn;
305 Error(
"SetPoint",
"illegal point index");
308 if (((fftw_r2r_kind*)
fKind)[0]==FFTW_HC2R){
309 if ((
fN[0]%2)==0 && ipoint==
fN[0]/2)
310 ((Double_t*)
fIn)[ipoint] = re;
312 ((Double_t*)
fIn)[ipoint] = re;
313 ((Double_t*)
fIn)[
fN[0]-ipoint]=im;
317 ((Double_t*)
fIn)[ipoint]=re;
326 Int_t ireal = ipoint[0];
327 for (Int_t i=0; i<
fNdim-1; i++)
328 ireal=
fN[i+1]*ireal + ipoint[i+1];
330 Error(
"SetPoint",
"illegal point index");
333 ((Double_t*)
fIn)[ireal]=re;
342 ((Double_t*)
fIn)[i] = data[i];
352 Error(
"Init",
"Multidimensional R2HC transforms are not supported, use R2C interface instead");
355 ((fftw_r2r_kind*)
fKind)[0] = FFTW_R2HC;
357 else if (kind[0] == 11) {
359 Error(
"Init",
"Multidimensional HC2R transforms are not supported, use C2R interface instead");
362 ((fftw_r2r_kind*)
fKind)[0] = FFTW_HC2R;
364 else if (kind[0] == 12) {
365 for (Int_t i=0; i<
fNdim; i++)
366 ((fftw_r2r_kind*)
fKind)[i] = FFTW_DHT;
369 for (Int_t i=0; i<
fNdim; i++){
371 case 0: ((fftw_r2r_kind*)
fKind)[i] = FFTW_REDFT00;
break;
372 case 1: ((fftw_r2r_kind*)fKind)[i] = FFTW_REDFT01;
break;
373 case 2: ((fftw_r2r_kind*)fKind)[i] = FFTW_REDFT10;
break;
374 case 3: ((fftw_r2r_kind*)fKind)[i] = FFTW_REDFT11;
break;
375 case 4: ((fftw_r2r_kind*)fKind)[i] = FFTW_RODFT00;
break;
376 case 5: ((fftw_r2r_kind*)fKind)[i] = FFTW_RODFT01;
break;
377 case 6: ((fftw_r2r_kind*)fKind)[i] = FFTW_RODFT10;
break;
378 case 7: ((fftw_r2r_kind*)fKind)[i] = FFTW_RODFT11;
break;
380 ((fftw_r2r_kind*)fKind)[i] = FFTW_R2HC;
break;
398 if (opt.Contains(
"ES"))
399 return FFTW_ESTIMATE;
400 if (opt.Contains(
"M"))
402 if (opt.Contains(
"P"))
404 if (opt.Contains(
"EX"))
405 return FFTW_EXHAUSTIVE;
406 return FFTW_ESTIMATE;
virtual void SetPoints(const Double_t *data)
Sets all points.
virtual Double_t GetPointReal(Int_t ipoint, Bool_t fromInput=kFALSE) const
For 1d tranforms. Returns point #ipoint.
virtual Double_t * GetPointsReal(Bool_t fromInput=kFALSE) const
Returns the output (or input) array.
virtual Option_t * GetType() const
Returns the type of the transform.
virtual void GetPointComplex(const Int_t *ipoint, Double_t &re, Double_t &im, Bool_t fromInput=kFALSE) const
Only for input of HC2R and output of R2HC and for 1d.
Int_t MapOptions(const Int_t *kind)
transfers the r2r_kind parameters to fftw type
UInt_t MapFlag(Option_t *flag)
allowed options: "ES" - FFTW_ESTIMATE "M" - FFTW_MEASURE "P" - FFTW_PATIENT "EX" - FFTW_EXHAUSTIVE ...
virtual void Init(Option_t *flags, Int_t sign, const Int_t *kind)
Creates the fftw-plan.
virtual void SetPoint(Int_t ipoint, Double_t re, Double_t im=0)
virtual ~TFFTReal()
clean-up
virtual void Transform()
Computes the transform, specified in Init() function.
virtual void GetPoints(Double_t *data, Bool_t fromInput=kFALSE) const
Copies the output (or input) points into the provided array, that should be big enough.