23 #if !defined (octave_oct_fftw_h)
24 #define octave_oct_fftw_h 1
28 #if defined (HAVE_FFTW3_H)
35 #if defined (HAVE_FFTW)
59 static bool instance_ok (
void);
62 create_plan (
int dir,
const int rank,
const dim_vector dims,
67 static fftw_plan dummy;
70 ? instance->do_create_plan (dir, rank, dims, howmany, stride,
80 static fftw_plan dummy;
83 ? instance->do_create_plan (rank, dims, howmany, stride, dist,
92 return instance_ok () ? instance->do_method () : dummy;
99 return instance_ok () ? instance->do_method (_meth) : dummy;
102 #if defined (HAVE_FFTW3F_THREADS)
103 static void threads (
int _nthreads)
105 if (instance_ok () && _nthreads != threads ())
107 instance->nthreads = _nthreads;
108 fftw_plan_with_nthreads (_nthreads);
110 instance->rplan = instance->plan[0] = instance->plan[1] = 0;
114 static int threads ()
116 return instance_ok () ? instance->nthreads : 0;
133 do_create_plan (
int dir,
const int rank,
const dim_vector dims,
139 do_create_plan (
const int rank,
const dim_vector dims,
143 FftwMethod do_method (
void);
145 FftwMethod do_method (FftwMethod _meth);
192 #if defined (HAVE_FFTW3_THREADS)
220 static bool instance_ok (
void);
228 static fftwf_plan dummy;
230 return instance_ok ()
231 ? instance->do_create_plan (dir, rank, dims, howmany, stride,
241 static fftwf_plan dummy;
243 return instance_ok ()
244 ? instance->do_create_plan (rank, dims, howmany, stride, dist,
253 return instance_ok () ? instance->do_method () : dummy;
260 return instance_ok () ? instance->do_method (_meth) : dummy;
263 #if defined (HAVE_FFTW3F_THREADS)
264 static void threads (
int _nthreads)
266 if (instance_ok () && _nthreads != threads ())
268 instance->nthreads = _nthreads;
269 fftwf_plan_with_nthreads (_nthreads);
271 instance->rplan = instance->plan[0] = instance->plan[1] = 0;
275 static int threads ()
277 return instance_ok () ? instance->nthreads : 0;
294 do_create_plan (
int dir,
const int rank,
const dim_vector dims,
300 do_create_plan (
const int rank,
const dim_vector dims,
304 FftwMethod do_method (
void);
306 FftwMethod do_method (FftwMethod _meth);
353 #if defined (HAVE_FFTW3F_THREADS)
365 static int fft (
const double *in,
Complex *out,
size_t npts,
381 static int fft (
const float *in,
FloatComplex *out,
size_t npts,