// @(#)root/fft:$Id$ // Author: Anna Kreshuk 07/4/2006 /************************************************************************* * Copyright (C) 1995-2006, Rene Brun and Fons Rademakers. * * All rights reserved. * * * * For the licensing terms see $ROOTSYS/LICENSE. * * For the list of contributors see $ROOTSYS/README/CREDITS. * *************************************************************************/ ////////////////////////////////////////////////////////////////////////// // // TFFTComplex // 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 complex input/output discrete Fourier transforms (DFT) // in one or more dimensions. 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 TFFTComplex - 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 // 3) Set the data (via SetPoints(), SetPoint() or SetPointComplex() functions) // 4) Run the Transform() function // 5) Get the output (via GetPoints(), GetPoint() or GetPointComplex() functions) // 6) Repeat steps 3)-5) as needed // // For a transform of the same size, but with different flags or sign, 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 the transform size // ////////////////////////////////////////////////////////////////////////// #include "TFFTComplex.h" #include "fftw3.h" #include "TComplex.h" ClassImp(TFFTComplex) //_____________________________________________________________________________ TFFTComplex::TFFTComplex() { //default fIn = 0; fOut = 0; fPlan = 0; fN = 0; fFlags = 0; fNdim = 0; fTotalSize = 0; fSign = 1; } //_____________________________________________________________________________ TFFTComplex::TFFTComplex(Int_t n, Bool_t inPlace) { //For 1d transforms //Allocates memory for the input array, and, if inPlace = kFALSE, for the output array fIn = fftw_malloc(sizeof(fftw_complex) *n); if (!inPlace) fOut = fftw_malloc(sizeof(fftw_complex) * n); else fOut = 0; fN = new Int_t[1]; fN[0] = n; fTotalSize = n; fNdim = 1; fSign = 1; fPlan = 0; fFlags = 0; } //_____________________________________________________________________________ TFFTComplex::TFFTComplex(Int_t ndim, Int_t *n, Bool_t inPlace) { //For multidim. transforms //Allocates memory for the input array, and, if inPlace = kFALSE, for the output array fNdim = ndim; fTotalSize = 1; fN = new Int_t[fNdim]; for (Int_t i=0; i