gsl_fft.h

00001 /*
00002   -------------------------------------------------------------------
00003   
00004   Copyright (C) 2006, 2007, Andrew W. Steiner
00005   
00006   This file is part of O2scl.
00007   
00008   O2scl is free software; you can redistribute it and/or modify
00009   it under the terms of the GNU General Public License as published by
00010   the Free Software Foundation; either version 3 of the License, or
00011   (at your option) any later version.
00012   
00013   O2scl is distributed in the hope that it will be useful,
00014   but WITHOUT ANY WARRANTY; without even the implied warranty of
00015   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016   GNU General Public License for more details.
00017   
00018   You should have received a copy of the GNU General Public License
00019   along with O2scl. If not, see <http://www.gnu.org/licenses/>.
00020 
00021   -------------------------------------------------------------------
00022 */
00023 #ifndef O2SCL_GSL_FFT_H
00024 #define O2SCL_GSL_FFT_H
00025 
00026 #include <iostream>
00027 #include <o2scl/collection.h>
00028 #include <gsl/gsl_errno.h>
00029 #include <gsl/gsl_fft_real.h>
00030 #include <gsl/gsl_fft_halfcomplex.h>
00031 
00032 #ifndef DOXYGENP
00033 namespace o2scl {
00034 #endif
00035 
00036   /** 
00037       \brief Real mixed-radix fast Fourier transform
00038 
00039       This is a simple wrapper for the GSL FFT functions which
00040       automatically allocates the necessary memory.
00041   */
00042   class gsl_fft {
00043   public:
00044 
00045     gsl_fft();
00046 
00047     virtual ~gsl_fft();
00048 
00049     /** \brief Perform the FFT transform
00050      */
00051     int transform(int n, double *x);
00052 
00053     /** \brief Perform the inverse FFT transform
00054      */
00055     int inverse_transform(int n, double *x);
00056     
00057 #ifndef DOXYGEN_INTERNAL
00058 
00059   protected:
00060 
00061     /// The current memory size
00062     int mem_size;
00063 
00064     /// Reallocate memory 
00065     int mem_resize(int new_size);
00066 
00067     /// The GSL workspace
00068     gsl_fft_real_workspace *work;
00069 
00070     /// The table for the forward transform
00071     gsl_fft_real_wavetable *real;
00072 
00073     /// The table for the inverse transform
00074     gsl_fft_halfcomplex_wavetable *hc;
00075 
00076 #endif
00077 
00078   };
00079 
00080 #ifndef DOXYGENP
00081 }
00082 #endif
00083 
00084 #endif

Documentation generated with Doxygen and provided under the GNU Free Documentation License. See License Information for details.