ROOT logo
ROOT » CORE » BASE » TVirtualFFT

class TVirtualFFT: public TObject


 TVirtualFFT

 TVirtualFFT is an interface class for Fast Fourier Transforms.



 The default FFT library is FFTW. To use it, FFTW3 library should already
 be installed, and ROOT should be have fftw3 module enabled, with the directories
 of fftw3 include file and library specified (see installation instructions).
 Function SetDefaultFFT() allows to change the default library.

 Available transform types:
 FFT:
 - "C2CFORWARD" - a complex input/output discrete Fourier transform (DFT)
                  in one or more dimensions, -1 in the exponent
 - "C2CBACKWARD"- a complex input/output discrete Fourier transform (DFT)
                  in one or more dimensions, +1 in the exponent
 - "R2C"        - a real-input/complex-output discrete Fourier transform (DFT)
                  in one or more dimensions,
 - "C2R"        - inverse transforms to "R2C", taking complex input
                  (storing the non-redundant half of a logically Hermitian array)
                  to real output
 - "R2HC"       - a real-input DFT with 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
 - "HC2R"       - computes the reverse of FFTW_R2HC, above
 - "DHT"        - computes a discrete Hartley transform

 Sine/cosine transforms:
 Different types of transforms are specified by parameter kind of the SineCosine() static
 function. 4 different kinds of sine and cosine transforms are available
  DCT-I  (REDFT00 in FFTW3 notation)- kind=0
  DCT-II (REDFT01 in FFTW3 notation)- kind=1
  DCT-III(REDFT10 in FFTW3 notation)- kind=2
  DCT-IV (REDFT11 in FFTW3 notation)- kind=3
  DST-I  (RODFT00 in FFTW3 notation)- kind=4
  DST-II (RODFT01 in FFTW3 notation)- kind=5
  DST-III(RODFT10 in FFTW3 notation)- kind=6
  DST-IV (RODFT11 in FFTW3 notation)- kind=7
 Formulas and detailed descriptions can be found in the chapter
 "What FFTW really computes" of the FFTW manual

 NOTE: FFTW computes unnormalized transforms, so doing a transform, followed by its
       inverse will give the original array, multiplied by normalization constant
       (transform size(N) for FFT, 2*(N-1) for DCT-I, 2*(N+1) for DST-I, 2*N for
       other sine/cosine transforms)

 How to use it:
 Call to the static function FFT returns a pointer to a fast fourier transform
 with requested parameters. Call to the static function SineCosine returns a
 pointer to a sine or cosine transform with requested parameters. Example:
 {
    Int_t N = 10; Double_t *in = new Double_t[N];
    TVirtualFFT *fftr2c = TVirtualFFT::FFT(1, &N, "R2C");
    fftr2c->SetPoints(in);
    fftr2c->Transform();
    Double_t re, im;
    for (Int_t i=0; i<N; i++)
       fftr2c->GetPointComplex(i, re, im);

    fftr2c->SetPoints(in2);

    fftr2c->SetPoints(in3);

 }
 Different options are explained in the function comments






Function Members (Methods)

 
    This is an abstract class, constructors will not be documented.
    Look at the header to check for available constructors.

public:
virtual~TVirtualFFT()
voidTObject::AbstractMethod(const char* method) const
virtual voidTObject::AppendPad(Option_t* option = "")
virtual voidTObject::Browse(TBrowser* b)
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual voidTObject::Clear(Option_t* = "")
virtual TObject*TObject::Clone(const char* newname = "") const
virtual Int_tTObject::Compare(const TObject* obj) const
virtual voidTObject::Copy(TObject& object) const
virtual voidTObject::Delete(Option_t* option = "")MENU
virtual Int_tTObject::DistancetoPrimitive(Int_t px, Int_t py)
virtual voidTObject::Draw(Option_t* option = "")
virtual voidTObject::DrawClass() constMENU
virtual TObject*TObject::DrawClone(Option_t* option = "") constMENU
virtual voidTObject::Dump() constMENU
virtual voidTObject::Error(const char* method, const char* msgfmt) const
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual voidTObject::ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
static 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*GetCurrentTransform()
static const char*GetDefaultFFT()
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
virtual const char*TObject::GetIconName() const
virtual Int_t*GetN() const
virtual const char*TObject::GetName() const
virtual Int_tGetNdim() const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TObject::GetOption() const
virtual voidGetPointComplex(Int_t ipoint, Double_t& re, Double_t& im, Bool_t fromInput = kFALSE) const
virtual voidGetPointComplex(const Int_t* ipoint, Double_t& re, Double_t& im, Bool_t fromInput = kFALSE) const
virtual Double_tGetPointReal(Int_t ipoint, Bool_t fromInput = kFALSE) const
virtual Double_tGetPointReal(const Int_t* ipoint, Bool_t fromInput = kFALSE) const
virtual voidGetPoints(Double_t* data, Bool_t fromInput = kFALSE) const
virtual voidGetPointsComplex(Double_t* data, Bool_t fromInput = kFALSE) const
virtual voidGetPointsComplex(Double_t* re, Double_t* im, Bool_t fromInput = kFALSE) const
virtual Double_t*GetPointsReal(Bool_t fromInput = kFALSE) const
virtual Int_tGetSign() const
virtual const char*TObject::GetTitle() const
virtual Option_t*GetTransformFlag() const
virtual Option_t*GetType() const
virtual UInt_tTObject::GetUniqueID() const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTObject::Hash() const
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
virtual voidInit(Option_t* flag, Int_t sign, const Int_t* kind)
virtual voidTObject::Inspect() constMENU
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tTObject::IsFolder() const
virtual Bool_tIsInplace() const
Bool_tTObject::IsOnHeap() const
virtual Bool_tTObject::IsSortable() const
Bool_tTObject::IsZombie() const
virtual voidTObject::ls(Option_t* option = "") const
voidTObject::MayNotUse(const char* method) const
virtual Bool_tTObject::Notify()
voidTObject::Obsolete(const char* method, const char* asOfVers, const char* removedFromVers) const
static voidTObject::operator delete(void* ptr)
static voidTObject::operator delete(void* ptr, void* vp)
static voidTObject::operator delete[](void* ptr)
static voidTObject::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)
TVirtualFFT&operator=(const TVirtualFFT&)
virtual voidTObject::Paint(Option_t* option = "")
virtual voidTObject::Pop()
virtual voidTObject::Print(Option_t* option = "") const
virtual Int_tTObject::Read(const char* name)
virtual voidTObject::RecursiveRemove(TObject* obj)
voidTObject::ResetBit(UInt_t f)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU
virtual voidTObject::SavePrimitive(ostream& out, Option_t* option = "")
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
static voidSetDefaultFFT(const char* name = "")
virtual voidTObject::SetDrawOption(Option_t* option = "")MENU
static voidTObject::SetDtorOnly(void* obj)
static voidTObject::SetObjectStat(Bool_t stat)
virtual voidSetPoint(Int_t ipoint, Double_t re, Double_t im = 0)
virtual voidSetPoint(const Int_t* ipoint, Double_t re, Double_t im = 0)
virtual voidSetPointComplex(Int_t ipoint, TComplex& c)
virtual voidSetPoints(const Double_t* data)
virtual voidSetPointsComplex(const Double_t* re, const Double_t* im)
static voidSetTransform(TVirtualFFT* fft)
virtual voidTObject::SetUniqueID(UInt_t uid)
virtual voidShowMembers(TMemberInspector& insp)
static TVirtualFFT*SineCosine(Int_t ndim, Int_t* n, Int_t* r2rkind, Option_t* option)
virtual voidStreamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
virtual voidTransform()
virtual voidTObject::UseCurrentStyle()
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const
protected:
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
voidTObject::MakeZombie()

Data Members

protected:
static TStringfgDefaultdefault transformer
static TVirtualFFT*fgFFTcurrent transformer

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

~TVirtualFFT()
destructor
TVirtualFFT* FFT(Int_t ndim, Int_t* n, Option_t* option)
Returns a pointer to the FFT of requested size and type.
Parameters:
 -ndim : number of transform dimensions
 -n    : sizes of each dimension (an array at least ndim long)
 -option : consists of 3 parts - flag option and an option to create a new TVirtualFFT
         1) transform type option:
           Available transform types are:
           C2CForward, C2CBackward, C2R, R2C, R2HC, HC2R, DHT
           see class description for details
         2) flag option: choosing how much time should be spent in planning the transform:
           Possible 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.
         3) option allowing to choose between the global fgFFT and a new TVirtualFFT object
           ""  - default, changes and returns the global fgFFT variable
           "K" (from "keep")- without touching the global fgFFT,
           creates and returns a new TVirtualFFT*. User is then responsible for deleting it.
 Examples of valid options: "R2C ES K", "C2CF M", "DHT P K", etc.
TVirtualFFT* SineCosine(Int_t ndim, Int_t* n, Int_t* r2rkind, Option_t* option)
Returns a pointer to a sine or cosine transform of requested size and kind

Parameters:
 -ndim    : number of transform dimensions
 -n       : sizes of each dimension (an array at least ndim long)
 -r2rkind : 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
     DST-III  - kind=6
     DST-IV   - kind=7
 -option : consists of 2 parts - flag option and an option to create a new TVirtualFFT
         - flag option: choosing how much time should be spent in planning the transform:
           Possible 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.
         - option allowing to choose between the global fgFFT and a new TVirtualFFT object
           ""  - default, changes and returns the global fgFFT variable
           "K" (from "keep")- without touching the global fgFFT,
           creates and returns a new TVirtualFFT*. User is then responsible for deleting it.
 Examples of valid options: "ES K", "EX", etc
TVirtualFFT* GetCurrentTransform()
 static: return current fgFFT
void SetTransform(TVirtualFFT* fft)
 static: set the current transfrom to parameter
const char * GetDefaultFFT()
 static: return the name of the default fft
void SetDefaultFFT(const char* name = "")
 static: set name of default fft
Int_t * GetN() const
Int_t GetNdim() const
Option_t * GetType() const
Int_t GetSign() const
Option_t * GetTransformFlag() const
void Init(Option_t* flag, Int_t sign, const Int_t* kind)
Bool_t IsInplace() const
void GetPoints(Double_t* data, Bool_t fromInput = kFALSE) const
Double_t GetPointReal(Int_t ipoint, Bool_t fromInput = kFALSE) const
Double_t GetPointReal(const Int_t* ipoint, Bool_t fromInput = kFALSE) const
void GetPointComplex(Int_t ipoint, Double_t& re, Double_t& im, Bool_t fromInput = kFALSE) const
void GetPointComplex(const Int_t* ipoint, Double_t& re, Double_t& im, Bool_t fromInput = kFALSE) const
Double_t* GetPointsReal(Bool_t fromInput = kFALSE) const
void GetPointsComplex(Double_t* re, Double_t* im, Bool_t fromInput = kFALSE) const
void GetPointsComplex(Double_t* data, Bool_t fromInput = kFALSE) const
void SetPoint(Int_t ipoint, Double_t re, Double_t im = 0)
void SetPoint(const Int_t* ipoint, Double_t re, Double_t im = 0)
void SetPoints(const Double_t* data)
void SetPointComplex(Int_t ipoint, TComplex& c)
void SetPointsComplex(const Double_t* re, const Double_t* im)
void Transform()