Skip to content
Snippets Groups Projects
Commit 316efe6d authored by Rene Brun's avatar Rene Brun
Browse files

From Anna Kreshuk:

A new optional package "fftw" is introduced.
It is a wrapper to the FFTW3 library. To use those functions,
FFTW3 should already be installed by the user, and ROOT should be configured
  --with-fftw3-incdir = "the directory where fftw3.h is"
  --with-fftw3-libdir = "the directory where the fftw library is"
eg
  --with-fftw3-incdir=$HOME/fftw-3.1.1/api \
  --with-fftw3-libdir=$HOME/fftw-3.1.1/.libs \

A new class TVirtualFFT provides an abstract interface for Fast Fourier
Transforms. The 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 ���alfcomplex���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 (REDFT10 in FFTW3 notation)- kind=1
 DCT-III(REDFT01 in FFTW3 notation)- kind=2
 DCT-IV (REDFT11 in FFTW3 notation)- kind=3
 DST-I  (RODFT00 in FFTW3 notation)- kind=4
 DST-II (RODFT10 in FFTW3 notation)- kind=5
 DST-III(RODFT01 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);
   ...
}


git-svn-id: http://root.cern.ch/svn/root/trunk@14621 27541ba8-7e3a-0410-8455-c3a389f83636
parent afe6dd54
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment