comparison liboctave/numeric/oct-fftw.h @ 31607:aac27ad79be6 stable

maint: Re-indent code after switch to using namespace macros. * build-env.h, build-env.in.cc, Cell.h, __betainc__.cc, __eigs__.cc, __ftp__.cc, __ichol__.cc, __ilu__.cc, __isprimelarge__.cc, __magick_read__.cc, __pchip_deriv__.cc, amd.cc, base-text-renderer.cc, base-text-renderer.h, besselj.cc, bitfcns.cc, bsxfun.cc, c-file-ptr-stream.h, call-stack.cc, call-stack.h, ccolamd.cc, cellfun.cc, chol.cc, colamd.cc, dasrt.cc, data.cc, debug.cc, defaults.cc, defaults.h, det.cc, display.cc, display.h, dlmread.cc, dynamic-ld.cc, dynamic-ld.h, ellipj.cc, environment.cc, environment.h, error.cc, error.h, errwarn.h, event-manager.cc, event-manager.h, event-queue.cc, event-queue.h, fcn-info.cc, fcn-info.h, fft.cc, fft2.cc, file-io.cc, filter.cc, find.cc, ft-text-renderer.cc, ft-text-renderer.h, gcd.cc, gl-render.cc, gl-render.h, gl2ps-print.cc, gl2ps-print.h, graphics-toolkit.cc, graphics-toolkit.h, graphics.cc, gsvd.cc, gtk-manager.cc, gtk-manager.h, help.cc, help.h, hook-fcn.cc, hook-fcn.h, input.cc, input.h, interpreter-private.cc, interpreter-private.h, interpreter.cc, interpreter.h, inv.cc, jsondecode.cc, jsonencode.cc, latex-text-renderer.cc, latex-text-renderer.h, load-path.cc, load-path.h, load-save.cc, load-save.h, lookup.cc, ls-hdf5.cc, ls-mat4.cc, ls-mat5.cc, lsode.cc, lu.cc, mappers.cc, matrix_type.cc, max.cc, mex.cc, mexproto.h, mxarray.h, mxtypes.in.h, oct-errno.in.cc, oct-hdf5-types.cc, oct-hist.cc, oct-hist.h, oct-map.cc, oct-map.h, oct-opengl.h, oct-prcstrm.h, oct-process.cc, oct-process.h, oct-stdstrm.h, oct-stream.cc, oct-stream.h, oct-strstrm.h, octave-default-image.h, ordqz.cc, ordschur.cc, pager.cc, pager.h, pinv.cc, pow2.cc, pr-output.cc, psi.cc, qr.cc, quadcc.cc, rand.cc, regexp.cc, settings.cc, settings.h, sighandlers.cc, sighandlers.h, sparse-xpow.cc, sqrtm.cc, stack-frame.cc, stack-frame.h, stream-euler.cc, strfns.cc, svd.cc, syminfo.cc, syminfo.h, symrcm.cc, symrec.cc, symrec.h, symscope.cc, symscope.h, symtab.cc, symtab.h, sysdep.cc, sysdep.h, text-engine.cc, text-engine.h, text-renderer.cc, text-renderer.h, time.cc, toplev.cc, typecast.cc, url-handle-manager.cc, url-handle-manager.h, urlwrite.cc, utils.cc, utils.h, variables.cc, variables.h, xdiv.cc, __delaunayn__.cc, __init_fltk__.cc, __init_gnuplot__.cc, __ode15__.cc, __voronoi__.cc, audioread.cc, convhulln.cc, gzip.cc, cdef-class.cc, cdef-class.h, cdef-fwd.h, cdef-manager.cc, cdef-manager.h, cdef-method.cc, cdef-method.h, cdef-object.cc, cdef-object.h, cdef-package.cc, cdef-package.h, cdef-property.cc, cdef-property.h, cdef-utils.cc, cdef-utils.h, ov-base-diag.cc, ov-base-int.cc, ov-base-mat.cc, ov-base-mat.h, ov-base-scalar.cc, ov-base.cc, ov-base.h, ov-bool-mat.cc, ov-bool-mat.h, ov-bool-sparse.cc, ov-bool.cc, ov-builtin.h, ov-cell.cc, ov-ch-mat.cc, ov-class.cc, ov-class.h, ov-classdef.cc, ov-classdef.h, ov-complex.cc, ov-cx-diag.cc, ov-cx-mat.cc, ov-cx-sparse.cc, ov-dld-fcn.cc, ov-dld-fcn.h, ov-fcn-handle.cc, ov-fcn-handle.h, ov-fcn.h, ov-float.cc, ov-flt-complex.cc, ov-flt-cx-diag.cc, ov-flt-cx-mat.cc, ov-flt-re-diag.cc, ov-flt-re-mat.cc, ov-flt-re-mat.h, ov-intx.h, ov-java.cc, ov-lazy-idx.cc, ov-legacy-range.cc, ov-magic-int.cc, ov-mex-fcn.cc, ov-mex-fcn.h, ov-null-mat.cc, ov-perm.cc, ov-range.cc, ov-re-diag.cc, ov-re-mat.cc, ov-re-mat.h, ov-re-sparse.cc, ov-scalar.cc, ov-str-mat.cc, ov-struct.cc, ov-typeinfo.cc, ov-typeinfo.h, ov-usr-fcn.cc, ov-usr-fcn.h, ov.cc, ov.h, ovl.h, octave.cc, octave.h, op-b-sbm.cc, op-bm-sbm.cc, op-cs-scm.cc, op-fm-fcm.cc, op-fs-fcm.cc, op-s-scm.cc, op-scm-cs.cc, op-scm-s.cc, op-sm-cs.cc, ops.h, anon-fcn-validator.cc, anon-fcn-validator.h, bp-table.cc, bp-table.h, comment-list.cc, comment-list.h, filepos.h, lex.h, oct-lvalue.cc, oct-lvalue.h, parse.h, profiler.cc, profiler.h, pt-anon-scopes.cc, pt-anon-scopes.h, pt-arg-list.cc, pt-arg-list.h, pt-args-block.cc, pt-args-block.h, pt-array-list.cc, pt-array-list.h, pt-assign.cc, pt-assign.h, pt-binop.cc, pt-binop.h, pt-bp.cc, pt-bp.h, pt-cbinop.cc, pt-cbinop.h, pt-cell.cc, pt-cell.h, pt-check.cc, pt-check.h, pt-classdef.cc, pt-classdef.h, pt-cmd.h, pt-colon.cc, pt-colon.h, pt-const.cc, pt-const.h, pt-decl.cc, pt-decl.h, pt-eval.cc, pt-eval.h, pt-except.cc, pt-except.h, pt-exp.cc, pt-exp.h, pt-fcn-handle.cc, pt-fcn-handle.h, pt-id.cc, pt-id.h, pt-idx.cc, pt-idx.h, pt-jump.h, pt-loop.cc, pt-loop.h, pt-mat.cc, pt-mat.h, pt-misc.cc, pt-misc.h, pt-pr-code.cc, pt-pr-code.h, pt-select.cc, pt-select.h, pt-spmd.cc, pt-spmd.h, pt-stmt.cc, pt-stmt.h, pt-tm-const.cc, pt-tm-const.h, pt-unop.cc, pt-unop.h, pt-walk.cc, pt-walk.h, pt.cc, pt.h, token.cc, token.h, Range.cc, Range.h, idx-vector.cc, idx-vector.h, range-fwd.h, CollocWt.cc, CollocWt.h, aepbalance.cc, aepbalance.h, chol.cc, chol.h, gepbalance.cc, gepbalance.h, gsvd.cc, gsvd.h, hess.cc, hess.h, lo-mappers.cc, lo-mappers.h, lo-specfun.cc, lo-specfun.h, lu.cc, lu.h, oct-convn.cc, oct-convn.h, oct-fftw.cc, oct-fftw.h, oct-norm.cc, oct-norm.h, oct-rand.cc, oct-rand.h, oct-spparms.cc, oct-spparms.h, qr.cc, qr.h, qrp.cc, qrp.h, randgamma.cc, randgamma.h, randmtzig.cc, randmtzig.h, randpoisson.cc, randpoisson.h, schur.cc, schur.h, sparse-chol.cc, sparse-chol.h, sparse-lu.cc, sparse-lu.h, sparse-qr.cc, sparse-qr.h, svd.cc, svd.h, child-list.cc, child-list.h, dir-ops.cc, dir-ops.h, file-ops.cc, file-ops.h, file-stat.cc, file-stat.h, lo-sysdep.cc, lo-sysdep.h, lo-sysinfo.cc, lo-sysinfo.h, mach-info.cc, mach-info.h, oct-env.cc, oct-env.h, oct-group.cc, oct-group.h, oct-password.cc, oct-password.h, oct-syscalls.cc, oct-syscalls.h, oct-time.cc, oct-time.h, oct-uname.cc, oct-uname.h, action-container.cc, action-container.h, base-list.h, cmd-edit.cc, cmd-edit.h, cmd-hist.cc, cmd-hist.h, f77-fcn.h, file-info.cc, file-info.h, lo-array-errwarn.cc, lo-array-errwarn.h, lo-hash.cc, lo-hash.h, lo-ieee.h, lo-regexp.cc, lo-regexp.h, lo-utils.cc, lo-utils.h, oct-base64.cc, oct-base64.h, oct-glob.cc, oct-glob.h, oct-inttypes.h, oct-mutex.cc, oct-mutex.h, oct-refcount.h, oct-shlib.cc, oct-shlib.h, oct-sparse.cc, oct-sparse.h, oct-string.h, octave-preserve-stream-state.h, pathsearch.cc, pathsearch.h, quit.cc, quit.h, unwind-prot.cc, unwind-prot.h, url-transfer.cc, url-transfer.h: Re-indent code after switch to using namespace macros.
author Rik <rik@octave.org>
date Thu, 01 Dec 2022 18:02:15 -0800
parents e88a07dec498
children 597f3ee61a48
comparison
equal deleted inserted replaced
31605:e88a07dec498 31607:aac27ad79be6
35 #include "dim-vector.h" 35 #include "dim-vector.h"
36 #include "oct-cmplx.h" 36 #include "oct-cmplx.h"
37 37
38 OCTAVE_BEGIN_NAMESPACE(octave) 38 OCTAVE_BEGIN_NAMESPACE(octave)
39 39
40 class 40 class
41 OCTAVE_API 41 OCTAVE_API
42 fftw_planner 42 fftw_planner
43 { 43 {
44 protected: 44 protected:
45 45
46 fftw_planner (void); 46 fftw_planner (void);
47 47
48 public: 48 public:
49 49
50 // No copying! 50 // No copying!
51 51
52 fftw_planner (const fftw_planner&) = delete; 52 fftw_planner (const fftw_planner&) = delete;
53 53
54 fftw_planner& operator = (const fftw_planner&) = delete; 54 fftw_planner& operator = (const fftw_planner&) = delete;
55 55
56 ~fftw_planner (void); 56 ~fftw_planner (void);
57 57
58 enum FftwMethod 58 enum FftwMethod
59 { 59 {
60 UNKNOWN = -1, 60 UNKNOWN = -1,
61 ESTIMATE, 61 ESTIMATE,
62 MEASURE, 62 MEASURE,
63 PATIENT, 63 PATIENT,
64 EXHAUSTIVE, 64 EXHAUSTIVE,
65 HYBRID 65 HYBRID
66 };
67
68 static bool instance_ok (void);
69
70 static void *
71 create_plan (int dir, const int rank, const dim_vector& dims,
72 octave_idx_type howmany, octave_idx_type stride,
73 octave_idx_type dist, const Complex *in,
74 Complex *out)
75 {
76 return instance_ok ()
77 ? s_instance->do_create_plan (dir, rank, dims, howmany, stride,
78 dist, in, out)
79 : nullptr;
80 }
81
82 static void *
83 create_plan (const int rank, const dim_vector& dims,
84 octave_idx_type howmany, octave_idx_type stride,
85 octave_idx_type dist, const double *in, Complex *out)
86 {
87 return instance_ok ()
88 ? s_instance->do_create_plan (rank, dims, howmany, stride, dist,
89 in, out)
90 : nullptr;
91 }
92
93 static FftwMethod method (void)
94 {
95 static FftwMethod dummy;
96
97 return instance_ok () ? s_instance->do_method () : dummy;
98 }
99
100 static FftwMethod method (FftwMethod meth)
101 {
102 static FftwMethod dummy;
103
104 return instance_ok () ? s_instance->do_method (meth) : dummy;
105 }
106
107 static void threads (int nt);
108
109 static int threads (void)
110 {
111 return instance_ok () ? s_instance->m_nthreads : 0;
112 }
113
114 private:
115
116 static fftw_planner *s_instance;
117
118 static void cleanup_instance (void)
119 { delete s_instance; s_instance = nullptr; }
120
121 void *
122 do_create_plan (int dir, const int rank, const dim_vector& dims,
123 octave_idx_type howmany, octave_idx_type stride,
124 octave_idx_type dist, const Complex *in,
125 Complex *out);
126
127 void *
128 do_create_plan (const int rank, const dim_vector& dims,
129 octave_idx_type howmany, octave_idx_type stride,
130 octave_idx_type dist, const double *in, Complex *out);
131
132 FftwMethod do_method (void);
133
134 FftwMethod do_method (FftwMethod meth);
135
136 FftwMethod m_meth;
137
138 // FIXME: perhaps this should be split into two classes?
139
140 // Plan for fft and ifft of complex values
141 void *m_plan[2];
142
143 // dist
144 octave_idx_type m_d[2];
145
146 // stride
147 octave_idx_type m_s[2];
148
149 // rank
150 int m_r[2];
151
152 // howmany
153 octave_idx_type m_h[2];
154
155 // dims
156 dim_vector m_n[2];
157
158 bool m_simd_align[2];
159 bool m_inplace[2];
160
161 // Plan for fft of real values
162 void *m_rplan;
163
164 // dist
165 octave_idx_type m_rd;
166
167 // stride
168 octave_idx_type m_rs;
169
170 // rank
171 int m_rr;
172
173 // howmany
174 octave_idx_type m_rh;
175
176 // dims
177 dim_vector m_rn;
178
179 bool m_rsimd_align;
180
181 // number of threads. Always 1 unless compiled with multi-threading
182 // support.
183 int m_nthreads;
184 }; 66 };
185 67
186 class 68 static bool instance_ok (void);
187 OCTAVE_API 69
188 float_fftw_planner 70 static void *
189 { 71 create_plan (int dir, const int rank, const dim_vector& dims,
190 protected: 72 octave_idx_type howmany, octave_idx_type stride,
191 73 octave_idx_type dist, const Complex *in,
192 float_fftw_planner (void); 74 Complex *out)
193 75 {
194 public: 76 return instance_ok ()
195 77 ? s_instance->do_create_plan (dir, rank, dims, howmany, stride,
196 // No copying! 78 dist, in, out)
197 79 : nullptr;
198 float_fftw_planner (const float_fftw_planner&) = delete; 80 }
199 81
200 float_fftw_planner& 82 static void *
201 operator = (const float_fftw_planner&) = delete; 83 create_plan (const int rank, const dim_vector& dims,
202 84 octave_idx_type howmany, octave_idx_type stride,
203 ~float_fftw_planner (void); 85 octave_idx_type dist, const double *in, Complex *out)
204 86 {
205 enum FftwMethod 87 return instance_ok ()
206 { 88 ? s_instance->do_create_plan (rank, dims, howmany, stride, dist,
207 UNKNOWN = -1, 89 in, out)
208 ESTIMATE, 90 : nullptr;
209 MEASURE, 91 }
210 PATIENT, 92
211 EXHAUSTIVE, 93 static FftwMethod method (void)
212 HYBRID 94 {
213 }; 95 static FftwMethod dummy;
214 96
215 static bool instance_ok (void); 97 return instance_ok () ? s_instance->do_method () : dummy;
216 98 }
217 static void * 99
218 create_plan (int dir, const int rank, const dim_vector& dims, 100 static FftwMethod method (FftwMethod meth)
219 octave_idx_type howmany, octave_idx_type stride, 101 {
220 octave_idx_type dist, const FloatComplex *in, 102 static FftwMethod dummy;
221 FloatComplex *out) 103
222 { 104 return instance_ok () ? s_instance->do_method (meth) : dummy;
223 return instance_ok () 105 }
224 ? s_instance->do_create_plan (dir, rank, dims, howmany, stride, 106
225 dist, in, out) 107 static void threads (int nt);
226 : nullptr; 108
227 } 109 static int threads (void)
228 110 {
229 static void * 111 return instance_ok () ? s_instance->m_nthreads : 0;
230 create_plan (const int rank, const dim_vector& dims, 112 }
231 octave_idx_type howmany, octave_idx_type stride, 113
232 octave_idx_type dist, const float *in, FloatComplex *out) 114 private:
233 { 115
234 return instance_ok () 116 static fftw_planner *s_instance;
235 ? s_instance->do_create_plan (rank, dims, howmany, stride, dist, 117
236 in, out) 118 static void cleanup_instance (void)
237 : nullptr; 119 { delete s_instance; s_instance = nullptr; }
238 } 120
239 121 void *
240 static FftwMethod method (void) 122 do_create_plan (int dir, const int rank, const dim_vector& dims,
241 { 123 octave_idx_type howmany, octave_idx_type stride,
242 static FftwMethod dummy; 124 octave_idx_type dist, const Complex *in,
243 125 Complex *out);
244 return instance_ok () ? s_instance->do_method () : dummy; 126
245 } 127 void *
246 128 do_create_plan (const int rank, const dim_vector& dims,
247 static FftwMethod method (FftwMethod meth) 129 octave_idx_type howmany, octave_idx_type stride,
248 { 130 octave_idx_type dist, const double *in, Complex *out);
249 static FftwMethod dummy; 131
250 132 FftwMethod do_method (void);
251 return instance_ok () ? s_instance->do_method (meth) : dummy; 133
252 } 134 FftwMethod do_method (FftwMethod meth);
253 135
254 static void threads (int nt); 136 FftwMethod m_meth;
255 137
256 static int threads (void) 138 // FIXME: perhaps this should be split into two classes?
257 { 139
258 return instance_ok () ? s_instance->m_nthreads : 0; 140 // Plan for fft and ifft of complex values
259 } 141 void *m_plan[2];
260 142
261 private: 143 // dist
262 144 octave_idx_type m_d[2];
263 static float_fftw_planner *s_instance; 145
264 146 // stride
265 static void cleanup_instance (void) 147 octave_idx_type m_s[2];
266 { delete s_instance; s_instance = nullptr; } 148
267 149 // rank
268 void * 150 int m_r[2];
269 do_create_plan (int dir, const int rank, const dim_vector& dims, 151
270 octave_idx_type howmany, octave_idx_type stride, 152 // howmany
271 octave_idx_type dist, const FloatComplex *in, 153 octave_idx_type m_h[2];
272 FloatComplex *out); 154
273 155 // dims
274 void * 156 dim_vector m_n[2];
275 do_create_plan (const int rank, const dim_vector& dims, 157
276 octave_idx_type howmany, octave_idx_type stride, 158 bool m_simd_align[2];
277 octave_idx_type dist, const float *in, FloatComplex *out); 159 bool m_inplace[2];
278 160
279 FftwMethod do_method (void); 161 // Plan for fft of real values
280 162 void *m_rplan;
281 FftwMethod do_method (FftwMethod meth); 163
282 164 // dist
283 FftwMethod m_meth; 165 octave_idx_type m_rd;
284 166
285 // FIXME: perhaps this should be split into two classes? 167 // stride
286 168 octave_idx_type m_rs;
287 // Plan for fft and ifft of complex values 169
288 void *m_plan[2]; 170 // rank
289 171 int m_rr;
290 // dist 172
291 octave_idx_type m_d[2]; 173 // howmany
292 174 octave_idx_type m_rh;
293 // stride 175
294 octave_idx_type m_s[2]; 176 // dims
295 177 dim_vector m_rn;
296 // rank 178
297 int m_r[2]; 179 bool m_rsimd_align;
298 180
299 // howmany 181 // number of threads. Always 1 unless compiled with multi-threading
300 octave_idx_type m_h[2]; 182 // support.
301 183 int m_nthreads;
302 // dims 184 };
303 dim_vector m_n[2]; 185
304 186 class
305 bool m_simd_align[2]; 187 OCTAVE_API
306 bool m_inplace[2]; 188 float_fftw_planner
307 189 {
308 // Plan for fft of real values 190 protected:
309 void *m_rplan; 191
310 192 float_fftw_planner (void);
311 // dist 193
312 octave_idx_type m_rd; 194 public:
313 195
314 // stride 196 // No copying!
315 octave_idx_type m_rs; 197
316 198 float_fftw_planner (const float_fftw_planner&) = delete;
317 // rank 199
318 int m_rr; 200 float_fftw_planner&
319 201 operator = (const float_fftw_planner&) = delete;
320 // howmany 202
321 octave_idx_type m_rh; 203 ~float_fftw_planner (void);
322 204
323 // dims 205 enum FftwMethod
324 dim_vector m_rn; 206 {
325 207 UNKNOWN = -1,
326 bool m_rsimd_align; 208 ESTIMATE,
327 209 MEASURE,
328 // number of threads. Always 1 unless compiled with multi-threading 210 PATIENT,
329 // support. 211 EXHAUSTIVE,
330 int m_nthreads; 212 HYBRID
331 }; 213 };
332 214
333 class 215 static bool instance_ok (void);
334 OCTAVE_API 216
335 fftw 217 static void *
336 { 218 create_plan (int dir, const int rank, const dim_vector& dims,
337 public: 219 octave_idx_type howmany, octave_idx_type stride,
338 220 octave_idx_type dist, const FloatComplex *in,
339 fftw (void) = delete; 221 FloatComplex *out)
340 222 {
341 // No copying. 223 return instance_ok ()
342 224 ? s_instance->do_create_plan (dir, rank, dims, howmany, stride,
343 fftw (const fftw&) = delete; 225 dist, in, out)
344 226 : nullptr;
345 fftw& operator = (const fftw&) = delete; 227 }
346 228
347 static int fft (const double *in, Complex *out, std::size_t npts, 229 static void *
348 std::size_t nsamples = 1, octave_idx_type stride = 1, 230 create_plan (const int rank, const dim_vector& dims,
349 octave_idx_type dist = -1); 231 octave_idx_type howmany, octave_idx_type stride,
350 static int fft (const Complex *in, Complex *out, std::size_t npts, 232 octave_idx_type dist, const float *in, FloatComplex *out)
351 std::size_t nsamples = 1, octave_idx_type stride = 1, 233 {
352 octave_idx_type dist = -1); 234 return instance_ok ()
353 static int ifft (const Complex *in, Complex *out, std::size_t npts, 235 ? s_instance->do_create_plan (rank, dims, howmany, stride, dist,
354 std::size_t nsamples = 1, octave_idx_type stride = 1, 236 in, out)
355 octave_idx_type dist = -1); 237 : nullptr;
356 238 }
357 static int fftNd (const double *, Complex *, const int, const dim_vector&); 239
358 static int fftNd (const Complex *, Complex *, const int, 240 static FftwMethod method (void)
359 const dim_vector&); 241 {
360 static int ifftNd (const Complex *, Complex *, const int, 242 static FftwMethod dummy;
361 const dim_vector&); 243
362 244 return instance_ok () ? s_instance->do_method () : dummy;
363 static int fft (const float *in, FloatComplex *out, std::size_t npts, 245 }
364 std::size_t nsamples = 1, octave_idx_type stride = 1, 246
365 octave_idx_type dist = -1); 247 static FftwMethod method (FftwMethod meth)
366 static int fft (const FloatComplex *in, FloatComplex *out, std::size_t npts, 248 {
367 std::size_t nsamples = 1, octave_idx_type stride = 1, 249 static FftwMethod dummy;
368 octave_idx_type dist = -1); 250
369 static int ifft (const FloatComplex *in, FloatComplex *out, std::size_t npts, 251 return instance_ok () ? s_instance->do_method (meth) : dummy;
370 std::size_t nsamples = 1, octave_idx_type stride = 1, 252 }
371 octave_idx_type dist = -1); 253
372 254 static void threads (int nt);
373 static int fftNd (const float *, FloatComplex *, const int, 255
374 const dim_vector&); 256 static int threads (void)
375 static int fftNd (const FloatComplex *, FloatComplex *, const int, 257 {
376 const dim_vector&); 258 return instance_ok () ? s_instance->m_nthreads : 0;
377 static int ifftNd (const FloatComplex *, FloatComplex *, const int, 259 }
378 const dim_vector&); 260
379 }; 261 private:
380 262
381 extern OCTAVE_API std::string fftw_version (void); 263 static float_fftw_planner *s_instance;
382 extern OCTAVE_API std::string fftwf_version (void); 264
265 static void cleanup_instance (void)
266 { delete s_instance; s_instance = nullptr; }
267
268 void *
269 do_create_plan (int dir, const int rank, const dim_vector& dims,
270 octave_idx_type howmany, octave_idx_type stride,
271 octave_idx_type dist, const FloatComplex *in,
272 FloatComplex *out);
273
274 void *
275 do_create_plan (const int rank, const dim_vector& dims,
276 octave_idx_type howmany, octave_idx_type stride,
277 octave_idx_type dist, const float *in, FloatComplex *out);
278
279 FftwMethod do_method (void);
280
281 FftwMethod do_method (FftwMethod meth);
282
283 FftwMethod m_meth;
284
285 // FIXME: perhaps this should be split into two classes?
286
287 // Plan for fft and ifft of complex values
288 void *m_plan[2];
289
290 // dist
291 octave_idx_type m_d[2];
292
293 // stride
294 octave_idx_type m_s[2];
295
296 // rank
297 int m_r[2];
298
299 // howmany
300 octave_idx_type m_h[2];
301
302 // dims
303 dim_vector m_n[2];
304
305 bool m_simd_align[2];
306 bool m_inplace[2];
307
308 // Plan for fft of real values
309 void *m_rplan;
310
311 // dist
312 octave_idx_type m_rd;
313
314 // stride
315 octave_idx_type m_rs;
316
317 // rank
318 int m_rr;
319
320 // howmany
321 octave_idx_type m_rh;
322
323 // dims
324 dim_vector m_rn;
325
326 bool m_rsimd_align;
327
328 // number of threads. Always 1 unless compiled with multi-threading
329 // support.
330 int m_nthreads;
331 };
332
333 class
334 OCTAVE_API
335 fftw
336 {
337 public:
338
339 fftw (void) = delete;
340
341 // No copying.
342
343 fftw (const fftw&) = delete;
344
345 fftw& operator = (const fftw&) = delete;
346
347 static int fft (const double *in, Complex *out, std::size_t npts,
348 std::size_t nsamples = 1, octave_idx_type stride = 1,
349 octave_idx_type dist = -1);
350 static int fft (const Complex *in, Complex *out, std::size_t npts,
351 std::size_t nsamples = 1, octave_idx_type stride = 1,
352 octave_idx_type dist = -1);
353 static int ifft (const Complex *in, Complex *out, std::size_t npts,
354 std::size_t nsamples = 1, octave_idx_type stride = 1,
355 octave_idx_type dist = -1);
356
357 static int fftNd (const double *, Complex *, const int, const dim_vector&);
358 static int fftNd (const Complex *, Complex *, const int,
359 const dim_vector&);
360 static int ifftNd (const Complex *, Complex *, const int,
361 const dim_vector&);
362
363 static int fft (const float *in, FloatComplex *out, std::size_t npts,
364 std::size_t nsamples = 1, octave_idx_type stride = 1,
365 octave_idx_type dist = -1);
366 static int fft (const FloatComplex *in, FloatComplex *out, std::size_t npts,
367 std::size_t nsamples = 1, octave_idx_type stride = 1,
368 octave_idx_type dist = -1);
369 static int ifft (const FloatComplex *in, FloatComplex *out, std::size_t npts,
370 std::size_t nsamples = 1, octave_idx_type stride = 1,
371 octave_idx_type dist = -1);
372
373 static int fftNd (const float *, FloatComplex *, const int,
374 const dim_vector&);
375 static int fftNd (const FloatComplex *, FloatComplex *, const int,
376 const dim_vector&);
377 static int ifftNd (const FloatComplex *, FloatComplex *, const int,
378 const dim_vector&);
379 };
380
381 extern OCTAVE_API std::string fftw_version (void);
382 extern OCTAVE_API std::string fftwf_version (void);
383 383
384 OCTAVE_END_NAMESPACE(octave) 384 OCTAVE_END_NAMESPACE(octave)
385 385
386 #endif 386 #endif