# class TFFTReal: public TVirtualFFT

```
TFFTReal
One of the interface classes to the FFTW package, can be used directly
or via the TVirtualFFT class. Only the basic interface of FFTW is implemented.

Computes transforms called r2r in FFTW manual:
- transforms of real input and output in "halfcomplex" format i.e.
real and imaginary parts for a transform of size n stored as
(r0, r1, r2, ..., rn/2, i(n+1)/2-1, ..., i2, i1)
- discrete Hartley transform
- sine and cosine transforms (DCT-I,II,III,IV and DST-I,II,III,IV)
For the detailed information on the computed
transforms please refer to the FFTW manual, chapter "What FFTW really computes".

How to use it:
1) Create an instance of TFFTReal - this will allocate input and output
arrays (unless an in-place transform is specified)
2) Run the Init() function with the desired flags and settings (see function
3) Set the data (via SetPoints()or SetPoint() functions)
4) Run the Transform() function
5) Get the output (via GetPoints() or GetPoint() functions)
6) Repeat steps 3)-5) as needed
For a transform of the same size, but of different kind (or with different flags),
rerun the Init() function and continue with steps 3)-5)

NOTE: 1) running Init() function will overwrite the input array! Don't set any data
before running the Init() function!
2) FFTW computes unnormalized transform, so doing a transform followed by
its inverse will lead to the original array scaled BY:
- transform size (N) for R2HC, HC2R, DHT transforms
- 2*(N-1) for DCT-I (REDFT00)
- 2*(N+1) for DST-I (RODFT00)
- 2*N for the remaining transforms
Transform inverses:
R2HC<-->HC2R
DHT<-->DHT
DCT-I<-->DCT-I
DCT-II<-->DCT-III
DCT-IV<-->DCT-IV
DST-I<-->DST-I
DST-II<-->DST-III
DST-IV<-->DST-IV

```

## Function Members (Methods)

public:
 TFFTReal() TFFTReal(const TFFTReal&) TFFTReal(Int_t n, Bool_t inPlace = kFALSE) TFFTReal(Int_t ndim, Int_t* n, Bool_t inPlace = kFALSE) virtual ~TFFTReal() void TObject::AbstractMethod(const char* method) const virtual void TObject::AppendPad(Option_t* option = "") virtual void TObject::Browse(TBrowser* b) static TClass* Class() virtual const char* TObject::ClassName() const virtual void TObject::Clear(Option_t* = "") virtual TObject* TObject::Clone(const char* newname = "") const virtual Int_t TObject::Compare(const TObject* obj) const virtual void TObject::Copy(TObject& object) const virtual void TObject::Delete(Option_t* option = "")MENU virtual Int_t TObject::DistancetoPrimitive(Int_t px, Int_t py) virtual void TObject::Draw(Option_t* option = "") virtual void TObject::DrawClass() constMENU virtual TObject* TObject::DrawClone(Option_t* option = "") constMENU virtual void TObject::Dump() constMENU virtual void TObject::Error(const char* method, const char* msgfmt) const virtual void TObject::Execute(const char* method, const char* params, Int_t* error = 0) virtual void TObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0) virtual void TObject::ExecuteEvent(Int_t event, Int_t px, Int_t py) virtual void TObject::Fatal(const char* method, const char* msgfmt) const static TVirtualFFT* TVirtualFFT::FFT(Int_t ndim, Int_t* n, Option_t* option) virtual TObject* TObject::FindObject(const char* name) const virtual TObject* TObject::FindObject(const TObject* obj) const static TVirtualFFT* TVirtualFFT::GetCurrentTransform() static const char* TVirtualFFT::GetDefaultFFT() virtual Option_t* TObject::GetDrawOption() const static Long_t TObject::GetDtorOnly() virtual const char* TObject::GetIconName() const virtual Int_t* GetN() const virtual const char* TObject::GetName() const virtual Int_t GetNdim() const virtual char* TObject::GetObjectInfo(Int_t px, Int_t py) const static Bool_t TObject::GetObjectStat() virtual Option_t* TObject::GetOption() const virtual void GetPointComplex(const Int_t* ipoint, Double_t& re, Double_t& im, Bool_t fromInput = kFALSE) const virtual void GetPointComplex(Int_t ipoint, Double_t& re, Double_t& im, Bool_t fromInput = kFALSE) const virtual Double_t GetPointReal(Int_t ipoint, Bool_t fromInput = kFALSE) const virtual Double_t GetPointReal(const Int_t* ipoint, Bool_t fromInput = kFALSE) const virtual void GetPoints(Double_t* data, Bool_t fromInput = kFALSE) const virtual void GetPointsComplex(Double_t*, Bool_t) const virtual void GetPointsComplex(Double_t*, Double_t*, Bool_t) const virtual Double_t* GetPointsReal(Bool_t fromInput = kFALSE) const virtual Int_t GetSign() const virtual Int_t GetSize() const virtual const char* TObject::GetTitle() const virtual Option_t* GetTransformFlag() const virtual Option_t* GetType() const virtual UInt_t TObject::GetUniqueID() const virtual Bool_t TObject::HandleTimer(TTimer* timer) virtual ULong_t TObject::Hash() const virtual void TObject::Info(const char* method, const char* msgfmt) const virtual Bool_t TObject::InheritsFrom(const char* classname) const virtual Bool_t TObject::InheritsFrom(const TClass* cl) const virtual void Init(Option_t* flags, Int_t sign, const Int_t* kind) virtual void TObject::Inspect() constMENU void TObject::InvertBit(UInt_t f) virtual TClass* IsA() const virtual Bool_t TObject::IsEqual(const TObject* obj) const virtual Bool_t TObject::IsFolder() const virtual Bool_t IsInplace() const Bool_t TObject::IsOnHeap() const virtual Bool_t TObject::IsSortable() const Bool_t TObject::IsZombie() const virtual void TObject::ls(Option_t* option = "") const void TObject::MayNotUse(const char* method) const virtual Bool_t TObject::Notify() void TObject::Obsolete(const char* method, const char* asOfVers, const char* removedFromVers) const static void TObject::operator delete(void* ptr) static void TObject::operator delete(void* ptr, void* vp) static void TObject::operator delete[](void* ptr) static void TObject::operator delete[](void* ptr, void* vp) void* TObject::operator new(size_t sz) void* TObject::operator new(size_t sz, void* vp) void* TObject::operator new[](size_t sz) void* TObject::operator new[](size_t sz, void* vp) TFFTReal& operator=(const TFFTReal&) virtual void TObject::Paint(Option_t* option = "") virtual void TObject::Pop() virtual void TObject::Print(Option_t* option = "") const virtual Int_t TObject::Read(const char* name) virtual void TObject::RecursiveRemove(TObject* obj) void TObject::ResetBit(UInt_t f) virtual void TObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU virtual void TObject::SavePrimitive(ostream& out, Option_t* option = "") void TObject::SetBit(UInt_t f) void TObject::SetBit(UInt_t f, Bool_t set) static void TVirtualFFT::SetDefaultFFT(const char* name = "") virtual void TObject::SetDrawOption(Option_t* option = "")MENU static void TObject::SetDtorOnly(void* obj) static void TObject::SetObjectStat(Bool_t stat) virtual void SetPoint(Int_t ipoint, Double_t re, Double_t im = 0) virtual void SetPoint(const Int_t* ipoint, Double_t re, Double_t) virtual void SetPointComplex(Int_t, TComplex&) virtual void SetPoints(const Double_t* data) virtual void SetPointsComplex(const Double_t*, const Double_t*) static void TVirtualFFT::SetTransform(TVirtualFFT* fft) virtual void TObject::SetUniqueID(UInt_t uid) virtual void ShowMembers(TMemberInspector& insp) static TVirtualFFT* TVirtualFFT::SineCosine(Int_t ndim, Int_t* n, Int_t* r2rkind, Option_t* option) virtual void Streamer(TBuffer& b) void StreamerNVirtual(TBuffer& b) virtual void TObject::SysError(const char* method, const char* msgfmt) const Bool_t TObject::TestBit(UInt_t f) const Int_t TObject::TestBits(UInt_t f) const virtual void Transform() virtual void TObject::UseCurrentStyle() virtual void TObject::Warning(const char* method, const char* msgfmt) const virtual Int_t TObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) virtual Int_t TObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const
protected:
 virtual void TObject::DoError(int level, const char* location, const char* fmt, va_list va) const void TObject::MakeZombie() UInt_t MapFlag(Option_t* flag) Int_t MapOptions(const Int_t* kind)

## Data Members

public:
 enum TObject::EStatusBits { kCanDelete kMustCleanup kObjInCanvas kIsReferenced kHasUUID kCannotPick kNoContextMenu kInvalidObject }; enum TObject::[unnamed] { kIsOnHeap kNotDeleted kZombie kBitMask kSingleKey kOverwrite kWriteDelete };
protected:
 Option_t* fFlags transform flags void* fIn input array void* fKind transform kinds in each dimension Int_t* fN transform sizes in each dimension Int_t fNdim number of dimensions void* fOut output array void* fPlan fftw plan (the plan how to compute the transform) Int_t fTotalSize total size of the transform static TString TVirtualFFT::fgDefault default transformer static TVirtualFFT* TVirtualFFT::fgFFT current transformer

## Function documentation

TFFTReal()
```default
```
TFFTReal(Int_t n, Bool_t inPlace = kFALSE)
```For 1d transforms
n here is the physical size of the transform (see FFTW manual for more details)
```
TFFTReal(Int_t ndim, Int_t* n, Bool_t inPlace = kFALSE)
```For multidimensional transforms
1st parameter is the # of dimensions,
2nd is the sizes (physical) of the transform in each dimension
```

```clean-up
```
void Init(Option_t* flags, Int_t sign, const Int_t* kind)
```Creates the fftw-plan

NOTE:  input and output arrays are overwritten during initialisation,
so don't set any points, before running this function!!!!!

1st parameter:
Possible flag_options:
"ES" (from "estimate") - no time in preparing the transform, but probably sub-optimal
performance
"M" (from "measure") - some time spend in finding the optimal way to do the transform
"P" (from "patient") - more time spend in finding the optimal way to do the transform
"EX" (from "exhaustive") - the most optimal way is found
This option should be chosen depending on how many transforms of the same size and
type are going to be done. Planning is only done once, for the first transform of this
size and type.
2nd parameter is dummy and doesn't need to be specified
3rd parameter- transform kind for each dimension
4 different kinds of sine and cosine transforms are available
DCT-I   - kind=0
DCT-II  - kind=1
DCT-III - kind=2
DCT-IV  - kind=3
DST-I   - kind=4
DST-II  - kind=5
DSTIII  - kind=6
DSTIV   - kind=7
```
void Transform()
```Computes the transform, specified in Init() function
```
Option_t * GetType() const
```Returns the type of the transform
```
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
```
Double_t GetPointReal(Int_t ipoint, Bool_t fromInput = kFALSE) const
```For 1d tranforms. Returns point #ipoint
```
Double_t GetPointReal(const Int_t* ipoint, Bool_t fromInput = kFALSE) const
```For multidim.transforms. Returns point #ipoint
```
void GetPointComplex(Int_t ipoint, Double_t& re, Double_t& im, Bool_t fromInput = kFALSE) const
```Only for input of HC2R and output of R2HC
```
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
```
Double_t* GetPointsReal(Bool_t fromInput = kFALSE) const
```Returns the output (or input) array
```
void SetPoint(Int_t ipoint, Double_t re, Double_t im = 0)
void SetPoint(const Int_t* ipoint, Double_t re, Double_t )
```Since multidimensional R2HC and HC2R transforms are not supported,
third parameter is dummy
```
void SetPoints(const Double_t* data)
```Sets all points
```
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
```
TFFTReal()
Int_t GetSize() const
`{return fTotalSize;}`
Int_t * GetN() const
`{return fN;}`
Int_t GetNdim() const
`{return fNdim;}`
Int_t GetSign() const
`{return 0;}`
Option_t * GetTransformFlag() const
`{return fFlags;}`
Bool_t IsInplace() const
`{if (fOut) return kTRUE; else return kFALSE;}`
void GetPointsComplex(Double_t* , Double_t* , Bool_t ) const
`{}`
void GetPointsComplex(Double_t* , Bool_t ) const
`{}`
void SetPointComplex(Int_t , TComplex& )
`{}`
void SetPointsComplex(const Double_t* , const Double_t* )
`{}`