diff options
Diffstat (limited to 'btl/libs/FFTW')
-rw-r--r-- | btl/libs/FFTW/fftw_interface.hh | 70 | ||||
-rw-r--r-- | btl/libs/FFTW/main.cpp | 62 |
2 files changed, 0 insertions, 132 deletions
diff --git a/btl/libs/FFTW/fftw_interface.hh b/btl/libs/FFTW/fftw_interface.hh deleted file mode 100644 index 318520c..0000000 --- a/btl/libs/FFTW/fftw_interface.hh +++ /dev/null @@ -1,70 +0,0 @@ -#ifndef BTL_FFTW_INTERFACE_H -#define BTL_FFTW_INTERFACE_H - -#include <complex> -#include <fftw3.h> -#include <vector> - -class fftw_interface -{ -public: - - static inline std::string name() - { - return std::string("fftw"); - } - - typedef std::complex<double> real_type; - typedef std::vector<std::complex<double> > stl_vector; - - typedef fftw_complex* gene_vector; - - typedef fftw_plan plan; - - static inline void free_vector(gene_vector & B){ - fftw_free(B); - } - - static inline void vector_from_stl(gene_vector & B, stl_vector & B_stl){ - int N = B_stl.size(); - B = (gene_vector) fftw_malloc(sizeof(fftw_complex) * N); - std::complex<double>* B_cplx = reinterpret_cast<std::complex<double>* >(B); - - for (int i=0;i<N;i++) - B_cplx[i] = B_stl[i]; - } - - static inline void vector_to_stl(gene_vector & B, stl_vector & B_stl){ - int N = B_stl.size(); - std::complex<double>* B_cplx = reinterpret_cast<std::complex<double>* >(B); - for (int i=0;i<N;i++) - B_stl[i] = B_cplx[i]; - } - - static inline void copy_vector(const gene_vector & source, gene_vector & cible, int N){ - for (int i=0;i<N;i++) { - cible[i][0]=source[i][0]; - cible[i][1]=source[i][1]; - } - } - - /* Begin FFTW operations */ - - static inline void fftw_init_plan(plan & p, const int & N, gene_vector & x, gene_vector & y, const int & sign, const int & flags){ - p = fftw_plan_dft_1d(N, x, y, sign, flags); - } - - static inline void fftw_init_plan_2d(plan & p, const int & N, gene_vector & x, gene_vector& y, const int & sign, const int & flags){ - p = fftw_plan_dft_2d(N, N, x, y, sign, flags); - } - - static inline void fftw_init_plan_3d(plan & p, const int & N, gene_vector & x, gene_vector& y, const int & sign, const int & flags){ - p = fftw_plan_dft_2d(N, N, N, x, y, sign, flags); - } - - static inline void fftw_run(plan & p){ - fftw_execute(p); - } -}; - -#endif // BTL_FFTW_INTERFACE_H diff --git a/btl/libs/FFTW/main.cpp b/btl/libs/FFTW/main.cpp deleted file mode 100644 index 034a279..0000000 --- a/btl/libs/FFTW/main.cpp +++ /dev/null @@ -1,62 +0,0 @@ -#include "utilities.h" -#include "bench.hh" -#include "fftw_interface.hh" -#include "fftw_actions.hh" - -#include <string> - -BTL_MAIN; - -int main(int argc, char **argv) -{ - bool - fftw_1d_forward_measure = false, - fftw_1d_forward_estimate = false, - fftw_1d_backward_measure = false, - fftw_1d_backward_estimate = false, - - fftw_2d_forward_measure = false, - fftw_2d_forward_estimate = false, - fftw_2d_backward_measure = false, - fftw_2d_backward_estimate = false - ; - - - for (int i = 1; i < argc; ++i) { - std::string arg = argv[i]; - - if (arg == "FFTW_1D_Forward_Measure" || arg == "all") fftw_1d_forward_measure = true; - if (arg == "FFTW_1D_Forward_Estimate" || arg == "all") fftw_1d_forward_estimate = true; - if (arg == "FFTW_1D_Backward_Measure" || arg == "all") fftw_1d_backward_measure = true; - if (arg == "FFTW_1D_Backward_Estimate" || arg == "all") fftw_1d_backward_estimate = true; - - if (arg == "FFTW_2D_Forward_Measure" || arg == "all") fftw_2d_forward_measure = true; - if (arg == "FFTW_2D_Forward_Estimate" || arg == "all") fftw_2d_forward_estimate = true; - if (arg == "FFTW_2D_Backward_Measure" || arg == "all") fftw_2d_backward_measure = true; - if (arg == "FFTW_2D_Backward_Estimate" || arg == "all") fftw_2d_backward_estimate = true; - } - - - if (fftw_1d_forward_measure) - bench<Action_FFTW_1D_Forward_Measure<fftw_interface> >(MIN_MV,MAX_MV,NB_POINT); - if (fftw_1d_forward_estimate) - bench<Action_FFTW_1D_Forward_Estimate<fftw_interface> >(MIN_MV,MAX_MV,NB_POINT); - if (fftw_1d_backward_measure) - bench<Action_FFTW_1D_Backward_Measure<fftw_interface> >(MIN_MV,MAX_MV,NB_POINT); - if (fftw_1d_backward_estimate) - bench<Action_FFTW_1D_Backward_Estimate<fftw_interface> >(MIN_MV,MAX_MV,NB_POINT); - - if (fftw_2d_forward_measure) - bench<Action_FFTW_2D_Forward_Measure<fftw_interface> >(MIN_MV,MAX_MV,NB_POINT); -// if (fftw_1d_forward_estimate) -// bench<Action_FFTW_1D_Forward_Estimate<fftw_interface> >(MIN_MV,MAX_MV,NB_POINT); -// if (fftw_1d_backward_measure) -// bench<Action_FFTW_1D_Backward_Measure<fftw_interface> >(MIN_MV,MAX_MV,NB_POINT); -// if (fftw_1d_backward_estimate) -// bench<Action_FFTW_1D_Backward_Estimate<fftw_interface> >(MIN_MV,MAX_MV,NB_POINT); - - - return 0; -} - - |