20 #include "fftw_common.hpp"
27 do_fftw(fftw_complex* pin, fftw_complex* pout,
const Indices& dims,
int direction) {
32 plan = fftw_plan_dft_1d(dims[0], pin, pout, direction, FFTW_ESTIMATE);
35 for (
int i = 0; i < d; i++) {
36 dimensions[d - i - 1] = dims[i];
38 plan = fftw_plan_dft(d, dimensions, pin, pout, direction, FFTW_ESTIMATE);
42 fftw_destroy_plan(plan);
46 do_fftw(fftw_complex* pin, fftw_complex* pout, index dim,
const Indices& dims,
int direction) {
49 fftw_iodim loop_dims[dims.size()-1];
52 for (index i = 0; i < dim; i++) {
53 loop_dims[i].n = dims[i];
54 loop_dims[i].is = stride;
55 loop_dims[i].os = stride;
56 stride *= loop_dims[i].n;
59 fft_dim.n = dims[dim];
64 for (index i = dim+1; i < dims.size(); i++) {
65 loop_dims[i-1].n = dims[i];
66 loop_dims[i-1].is = stride;
67 loop_dims[i-1].os = stride;
68 stride *= loop_dims[i-1].n;
72 fftw_plan plan = fftw_plan_guru_dft(1, &fft_dim, dims.size()-1, loop_dims,
73 pin, pout, direction, FFTW_ESTIMATE);
75 fftw_destroy_plan(plan);
79 do_fftw(fftw_complex* pin, fftw_complex* pout,
const Booleans& convert,
const Indices& dims,
int direction) {
81 fftw_iodim fft_dims[dims.size()];
82 fftw_iodim loop_dims[dims.size()];
87 for (index i = 0; i < dims.size(); i++) {
88 if (convert[i] ==
false) {
89 loop_dims[loop_size].n = dims[i];
90 loop_dims[loop_size].is = stride;
91 loop_dims[loop_size].os = stride;
94 fft_dims[fft_size].n = dims[i];
95 fft_dims[fft_size].is = stride;
96 fft_dims[fft_size].os = stride;
104 fftw_plan plan = fftw_plan_guru_dft(fft_size, fft_dims, loop_size, loop_dims,
105 pin, pout, direction, FFTW_ESTIMATE);
107 fftw_destroy_plan(plan);