Changeset 1405 in Sophya for trunk/SophyaLib/NTools


Ignore:
Timestamp:
Feb 15, 2001, 6:58:16 PM (25 years ago)
Author:
ansari
Message:

Ajout documentation - Reza 15/2/2001

Location:
trunk/SophyaLib/NTools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/NTools/fftpserver.cc

    r1402 r1405  
    1515necessarily correspond with the equivalent fftpack function.  For example,
    1616fftpack "forward" transformations are in fact inverse fourier transformations.
    17 Otherwise, the output is in the fftpack format.
    18 
    1917
    2018Due to the way that fftpack manages
     
    2321of differing length, it may be more efficient to create an fftserver object
    2422for each length.
     23
     24  \code
     25  #include "fftpserver.h"
     26  // ...
     27  TVector<r_8> in(32);
     28  TVector< complex<r_8> > out;
     29  in = RandomSequence();
     30  FFTPackServer ffts;
     31  ffts.setNormalize(true);  // To have normalized transforms
     32  cout << " FFTServer info string= " << ffts.getInfo() << endl;
     33  cout << "in= " << in << endl;
     34  cout << " Calling ffts.FFTForward(in, out) : " << endl;
     35  ffts.FFTForward(in, out);
     36  cout << "out= " << out << endl;
     37  \endcode
    2538*/
    2639
  • trunk/SophyaLib/NTools/fftservintf.cc

    r1402 r1405  
    66  \ingroup NTools
    77  Defines the interface for FFT (Fast Fourier Transform) operations.
     8  Definitions :
     9    - Sampling period \b T
     10    - Sampling frequency \b fs=1/T
     11    - Total number of samples \b N
     12    - Frequency step in Fourier space \b =fs/N=1/(N*T)
     13    - Component frequencies
     14        - k=0      ->  0
     15        - k=1      ->  1/(N*T)
     16        - k        ->  k/(N*T)
     17        - k=N/2    ->  1/(2*T)   (Nyquist frequency)
     18        - k>N/2    ->  k/(N*T)   (or negative frequency -(N-k)/(N*T))
     19
     20  For a sampling period T=1, the computed Fourier components correspond to :
     21  \verbatim
     22  0  1/N  2/N  ... 1/2  1/2+1/N  1/2+2/N ... 1-2/N  1-1/N
     23  0  1/N  2/N  ... 1/2                   ...  -2/N   -1/N
     24  \endverbatim
     25
     26  For complex one-dimensional transforms:
     27  \f[
     28  out(i) = F_{norm} \Sigma_{j} \ e^{-2 \pi \sqrt{-1} \ i \  j} \ {\rm (forward)}
     29  \f]
     30  \f[
     31  out(i) = F_{norm} \Sigma_{j} \ e^{2 \pi \sqrt{-1} \ i \  j} \ {\rm (backward)}
     32  \f]
     33  i,j= 0..N-1 , where N is the input or the output array size.
     34
     35  For complex multi-dimensional transforms:
     36  \f[
     37  out(i1,i2,...,id) = F_{norm} \Sigma_{j1} \Sigma_{j2} ... \Sigma_{jd} \
     38  e^{-2 \pi \sqrt{-1} \ i1 \ j1} ... e^{-2 \pi \sqrt{-1} \ id \ jd} \ {\rm (forward)}
     39  \f]
     40  \f[
     41  out(i1,i2,...,id) = F_{norm} \Sigma_{j1} \Sigma_{j2} ... \Sigma_{jd} \
     42  e^{2 \pi \sqrt{-1} \ i1 \ j1} ... e^{2 \pi \sqrt{-1} \ id \ jd} \ {\rm (backward)}
     43  \f]
     44
     45  For real forward transforms, the input array is real, and
     46  the output array complex, with Fourier components up to k=N/2.
     47  For real backward transforms, the input array is complex and
     48  the output array is real.
    849*/
    950
     
    2364
    2465/* --Methode-- */
     66//! Forward Fourier transform for double precision complex data
     67/*!
     68  \param in : Input complex array
     69  \param out : Output complex array
     70 */
    2571void FFTServerInterface::FFTForward(TArray< complex<r_8> > const &, TArray< complex<r_8> > &)
    2672{
     
    2975
    3076/* --Methode-- */
     77//! Backward (inverse) Fourier transform for double precision complex data
     78/*!
     79  \param in : Input complex array
     80  \param out : Output complex array
     81 */
    3182void FFTServerInterface::FFTBackward(TArray< complex<r_8> > const &, TArray< complex<r_8> > &)
    3283{
     
    3586
    3687/* --Methode-- */
     88//! Forward Fourier transform for double precision real input data
     89/*!
     90  \param in : Input real array
     91  \param out : Output complex array
     92 */
    3793void FFTServerInterface::FFTForward(TArray< r_8 > const &, TArray< complex<r_8> > &)
    3894{
     
    4197
    4298/* --Methode-- */
     99//! Backward (inverse) Fourier transform for double precision real output data
     100/*!
     101  \param in : Input complex array
     102  \param out : Output real array
     103  \param usoutsz : if true, use the output array size for computing the inverse FFT.
     104 */
    43105void FFTServerInterface::FFTBackward(TArray< complex<r_8> > const &, TArray< r_8 > &, bool)
    44106{
     
    50112
    51113/* --Methode-- */
     114//! Forward Fourier transform for complex data
     115/*!
     116  \param in : Input complex array
     117  \param out : Output complex array
     118 */
    52119void FFTServerInterface::FFTForward(TArray< complex<r_4> > const &, TArray< complex<r_4> > &)
    53120{
     
    56123
    57124/* --Methode-- */
     125//! Backward (inverse) Fourier transform for complex data
     126/*!
     127  \param in : Input complex array
     128  \param out : Output complex array
     129 */
    58130void FFTServerInterface::FFTBackward(TArray< complex<r_4> > const &, TArray< complex<r_4> > &)
    59131{
     
    62134
    63135/* --Methode-- */
     136//! Forward Fourier transform for real input data
     137/*!
     138  \param in : Input real array
     139  \param out : Output complex array
     140 */
    64141void FFTServerInterface::FFTForward(TArray< r_4 > const &, TArray< complex<r_4> > &)
    65142{
     
    68145
    69146/* --Methode-- */
     147//! Backward (inverse) Fourier transform for real output data
     148/*!
     149  \param in : Input complex array
     150  \param out : Output real array
     151  \param usoutsz : if true, use the output array size for computing the inverse FFT.
     152 */
    70153void FFTServerInterface::FFTBackward(TArray< complex<r_4> > const &, TArray< r_4 > &, bool)
    71154{
     
    76159
    77160/* --Methode-- */
     161/*!
     162  \class SOPHYA::FFTArrayChecker
     163  \ingroup NTools
     164  Service class for checking array size and resizing output arrays,
     165  to be used by FFTServer classes
     166*/
     167
    78168template <class T>
    79169FFTArrayChecker<T>::FFTArrayChecker(string msg, bool checkpack, bool onedonly)
  • trunk/SophyaLib/NTools/fftservintf.h

    r1402 r1405  
    2727  virtual FFTServerInterface * Clone() = 0;
    2828
     29//! Set/clear the flag for normalizing Fourier transforms.
    2930  inline void setNormalize(bool fg=false) { _fgnorm = fg; }
     31//! Returns the status of normalization flag for the server
    3032  inline bool getNormalize() const { return(_fgnorm); }
     33//! Returns the information string associated with the server
    3134  inline string getInfo() const { return _info; }
    3235
     
    5356};
    5457
    55 } // Fin du namespace
    5658
    5759template <class T>
     
    7981};
    8082
     83} // Fin du namespace
     84
    8185#endif
Note: See TracChangeset for help on using the changeset viewer.