ASPiK SDK
Loading...
Searching...
No Matches
fftw3.h
1/*
2 * Copyright (c) 2003, 2007-14 Matteo Frigo
3 * Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
4 *
5 * The following statement of license applies *only* to this header file,
6 * and *not* to the other files distributed with FFTW or derived therefrom:
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 *
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
20 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
23 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
25 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */
31
32/***************************** NOTE TO USERS *********************************
33 *
34 * THIS IS A HEADER FILE, NOT A MANUAL
35 *
36 * If you want to know how to use FFTW, please read the manual,
37 * online at http://www.fftw.org/doc/ and also included with FFTW.
38 * For a quick start, see the manual's tutorial section.
39 *
40 * (Reading header files to learn how to use a library is a habit
41 * stemming from code lacking a proper manual. Arguably, it's a
42 * *bad* habit in most cases, because header files can contain
43 * interfaces that are not part of the public, stable API.)
44 *
45 ****************************************************************************/
46
47#ifndef FFTW3_H
48#define FFTW3_H
49
50#include <stdio.h>
51
52#ifdef __cplusplus
53extern "C"
54{
55#endif /* __cplusplus */
56
57/* If <complex.h> is included, use the C99 complex type. Otherwise
58 define a type bit-compatible with C99 complex */
59#if !defined(FFTW_NO_Complex) && defined(_Complex_I) && defined(complex) && defined(I)
60# define FFTW_DEFINE_COMPLEX(R, C) typedef R _Complex C
61#else
62# define FFTW_DEFINE_COMPLEX(R, C) typedef R C[2]
63#endif
64
65#define FFTW_CONCAT(prefix, name) prefix ## name
66#define FFTW_MANGLE_DOUBLE(name) FFTW_CONCAT(fftw_, name)
67#define FFTW_MANGLE_FLOAT(name) FFTW_CONCAT(fftwf_, name)
68#define FFTW_MANGLE_LONG_DOUBLE(name) FFTW_CONCAT(fftwl_, name)
69#define FFTW_MANGLE_QUAD(name) FFTW_CONCAT(fftwq_, name)
70
71/* IMPORTANT: for Windows compilers, you should add a line
72*/
73#define FFTW_DLL
74/*
75 here and in kernel/ifftw.h if you are compiling/using FFTW as a
76 DLL, in order to do the proper importing/exporting, or
77 alternatively compile with -DFFTW_DLL or the equivalent
78 command-line flag. This is not necessary under MinGW/Cygwin, where
79 libtool does the imports/exports automatically. */
80#if defined(FFTW_DLL) && (defined(_WIN32) || defined(__WIN32__))
81 /* annoying Windows syntax for shared-library declarations */
82# if defined(COMPILING_FFTW) /* defined in api.h when compiling FFTW */
83# define FFTW_EXTERN extern __declspec(dllexport)
84# else /* user is calling FFTW; import symbol */
85# define FFTW_EXTERN extern __declspec(dllimport)
86# endif
87#else
88# define FFTW_EXTERN extern
89#endif
90
91enum fftw_r2r_kind_do_not_use_me {
92 FFTW_R2HC=0, FFTW_HC2R=1, FFTW_DHT=2,
93 FFTW_REDFT00=3, FFTW_REDFT01=4, FFTW_REDFT10=5, FFTW_REDFT11=6,
94 FFTW_RODFT00=7, FFTW_RODFT01=8, FFTW_RODFT10=9, FFTW_RODFT11=10
95};
96
98 int n; /* dimension size */
99 int is; /* input stride */
100 int os; /* output stride */
101};
102
103#include <stddef.h> /* for ptrdiff_t */
105 ptrdiff_t n; /* dimension size */
106 ptrdiff_t is; /* input stride */
107 ptrdiff_t os; /* output stride */
108};
109
110typedef void (*fftw_write_char_func_do_not_use_me)(char c, void *);
111typedef int (*fftw_read_char_func_do_not_use_me)(void *);
112
113/*
114 huge second-order macro that defines prototypes for all API
115 functions. We expand this macro for each supported precision
116
117 X: name-mangling macro
118 R: real data type
119 C: complex data type
120*/
121
122#define FFTW_DEFINE_API(X, R, C) \
123 \
124FFTW_DEFINE_COMPLEX(R, C); \
125 \
126typedef struct X(plan_s) *X(plan); \
127 \
128typedef struct fftw_iodim_do_not_use_me X(iodim); \
129typedef struct fftw_iodim64_do_not_use_me X(iodim64); \
130 \
131typedef enum fftw_r2r_kind_do_not_use_me X(r2r_kind); \
132 \
133typedef fftw_write_char_func_do_not_use_me X(write_char_func); \
134typedef fftw_read_char_func_do_not_use_me X(read_char_func); \
135 \
136FFTW_EXTERN void X(execute)(const X(plan) p); \
137 \
138FFTW_EXTERN X(plan) X(plan_dft)(int rank, const int *n, \
139 C *in, C *out, int sign, unsigned flags); \
140 \
141FFTW_EXTERN X(plan) X(plan_dft_1d)(int n, C *in, C *out, int sign, \
142 unsigned flags); \
143FFTW_EXTERN X(plan) X(plan_dft_2d)(int n0, int n1, \
144 C *in, C *out, int sign, unsigned flags); \
145FFTW_EXTERN X(plan) X(plan_dft_3d)(int n0, int n1, int n2, \
146 C *in, C *out, int sign, unsigned flags); \
147 \
148FFTW_EXTERN X(plan) X(plan_many_dft)(int rank, const int *n, \
149 int howmany, \
150 C *in, const int *inembed, \
151 int istride, int idist, \
152 C *out, const int *onembed, \
153 int ostride, int odist, \
154 int sign, unsigned flags); \
155 \
156FFTW_EXTERN X(plan) X(plan_guru_dft)(int rank, const X(iodim) *dims, \
157 int howmany_rank, \
158 const X(iodim) *howmany_dims, \
159 C *in, C *out, \
160 int sign, unsigned flags); \
161FFTW_EXTERN X(plan) X(plan_guru_split_dft)(int rank, const X(iodim) *dims, \
162 int howmany_rank, \
163 const X(iodim) *howmany_dims, \
164 R *ri, R *ii, R *ro, R *io, \
165 unsigned flags); \
166 \
167FFTW_EXTERN X(plan) X(plan_guru64_dft)(int rank, \
168 const X(iodim64) *dims, \
169 int howmany_rank, \
170 const X(iodim64) *howmany_dims, \
171 C *in, C *out, \
172 int sign, unsigned flags); \
173FFTW_EXTERN X(plan) X(plan_guru64_split_dft)(int rank, \
174 const X(iodim64) *dims, \
175 int howmany_rank, \
176 const X(iodim64) *howmany_dims, \
177 R *ri, R *ii, R *ro, R *io, \
178 unsigned flags); \
179 \
180FFTW_EXTERN void X(execute_dft)(const X(plan) p, C *in, C *out); \
181FFTW_EXTERN void X(execute_split_dft)(const X(plan) p, R *ri, R *ii, \
182 R *ro, R *io); \
183 \
184FFTW_EXTERN X(plan) X(plan_many_dft_r2c)(int rank, const int *n, \
185 int howmany, \
186 R *in, const int *inembed, \
187 int istride, int idist, \
188 C *out, const int *onembed, \
189 int ostride, int odist, \
190 unsigned flags); \
191 \
192FFTW_EXTERN X(plan) X(plan_dft_r2c)(int rank, const int *n, \
193 R *in, C *out, unsigned flags); \
194 \
195FFTW_EXTERN X(plan) X(plan_dft_r2c_1d)(int n,R *in,C *out,unsigned flags); \
196FFTW_EXTERN X(plan) X(plan_dft_r2c_2d)(int n0, int n1, \
197 R *in, C *out, unsigned flags); \
198FFTW_EXTERN X(plan) X(plan_dft_r2c_3d)(int n0, int n1, \
199 int n2, \
200 R *in, C *out, unsigned flags); \
201 \
202 \
203FFTW_EXTERN X(plan) X(plan_many_dft_c2r)(int rank, const int *n, \
204 int howmany, \
205 C *in, const int *inembed, \
206 int istride, int idist, \
207 R *out, const int *onembed, \
208 int ostride, int odist, \
209 unsigned flags); \
210 \
211FFTW_EXTERN X(plan) X(plan_dft_c2r)(int rank, const int *n, \
212 C *in, R *out, unsigned flags); \
213 \
214FFTW_EXTERN X(plan) X(plan_dft_c2r_1d)(int n,C *in,R *out,unsigned flags); \
215FFTW_EXTERN X(plan) X(plan_dft_c2r_2d)(int n0, int n1, \
216 C *in, R *out, unsigned flags); \
217FFTW_EXTERN X(plan) X(plan_dft_c2r_3d)(int n0, int n1, \
218 int n2, \
219 C *in, R *out, unsigned flags); \
220 \
221FFTW_EXTERN X(plan) X(plan_guru_dft_r2c)(int rank, const X(iodim) *dims, \
222 int howmany_rank, \
223 const X(iodim) *howmany_dims, \
224 R *in, C *out, \
225 unsigned flags); \
226FFTW_EXTERN X(plan) X(plan_guru_dft_c2r)(int rank, const X(iodim) *dims, \
227 int howmany_rank, \
228 const X(iodim) *howmany_dims, \
229 C *in, R *out, \
230 unsigned flags); \
231 \
232FFTW_EXTERN X(plan) X(plan_guru_split_dft_r2c)( \
233 int rank, const X(iodim) *dims, \
234 int howmany_rank, \
235 const X(iodim) *howmany_dims, \
236 R *in, R *ro, R *io, \
237 unsigned flags); \
238FFTW_EXTERN X(plan) X(plan_guru_split_dft_c2r)( \
239 int rank, const X(iodim) *dims, \
240 int howmany_rank, \
241 const X(iodim) *howmany_dims, \
242 R *ri, R *ii, R *out, \
243 unsigned flags); \
244 \
245FFTW_EXTERN X(plan) X(plan_guru64_dft_r2c)(int rank, \
246 const X(iodim64) *dims, \
247 int howmany_rank, \
248 const X(iodim64) *howmany_dims, \
249 R *in, C *out, \
250 unsigned flags); \
251FFTW_EXTERN X(plan) X(plan_guru64_dft_c2r)(int rank, \
252 const X(iodim64) *dims, \
253 int howmany_rank, \
254 const X(iodim64) *howmany_dims, \
255 C *in, R *out, \
256 unsigned flags); \
257 \
258FFTW_EXTERN X(plan) X(plan_guru64_split_dft_r2c)( \
259 int rank, const X(iodim64) *dims, \
260 int howmany_rank, \
261 const X(iodim64) *howmany_dims, \
262 R *in, R *ro, R *io, \
263 unsigned flags); \
264FFTW_EXTERN X(plan) X(plan_guru64_split_dft_c2r)( \
265 int rank, const X(iodim64) *dims, \
266 int howmany_rank, \
267 const X(iodim64) *howmany_dims, \
268 R *ri, R *ii, R *out, \
269 unsigned flags); \
270 \
271FFTW_EXTERN void X(execute_dft_r2c)(const X(plan) p, R *in, C *out); \
272FFTW_EXTERN void X(execute_dft_c2r)(const X(plan) p, C *in, R *out); \
273 \
274FFTW_EXTERN void X(execute_split_dft_r2c)(const X(plan) p, \
275 R *in, R *ro, R *io); \
276FFTW_EXTERN void X(execute_split_dft_c2r)(const X(plan) p, \
277 R *ri, R *ii, R *out); \
278 \
279FFTW_EXTERN X(plan) X(plan_many_r2r)(int rank, const int *n, \
280 int howmany, \
281 R *in, const int *inembed, \
282 int istride, int idist, \
283 R *out, const int *onembed, \
284 int ostride, int odist, \
285 const X(r2r_kind) *kind, unsigned flags); \
286 \
287FFTW_EXTERN X(plan) X(plan_r2r)(int rank, const int *n, R *in, R *out, \
288 const X(r2r_kind) *kind, unsigned flags); \
289 \
290FFTW_EXTERN X(plan) X(plan_r2r_1d)(int n, R *in, R *out, \
291 X(r2r_kind) kind, unsigned flags); \
292FFTW_EXTERN X(plan) X(plan_r2r_2d)(int n0, int n1, R *in, R *out, \
293 X(r2r_kind) kind0, X(r2r_kind) kind1, \
294 unsigned flags); \
295FFTW_EXTERN X(plan) X(plan_r2r_3d)(int n0, int n1, int n2, \
296 R *in, R *out, X(r2r_kind) kind0, \
297 X(r2r_kind) kind1, X(r2r_kind) kind2, \
298 unsigned flags); \
299 \
300FFTW_EXTERN X(plan) X(plan_guru_r2r)(int rank, const X(iodim) *dims, \
301 int howmany_rank, \
302 const X(iodim) *howmany_dims, \
303 R *in, R *out, \
304 const X(r2r_kind) *kind, unsigned flags); \
305 \
306FFTW_EXTERN X(plan) X(plan_guru64_r2r)(int rank, const X(iodim64) *dims, \
307 int howmany_rank, \
308 const X(iodim64) *howmany_dims, \
309 R *in, R *out, \
310 const X(r2r_kind) *kind, unsigned flags); \
311 \
312FFTW_EXTERN void X(execute_r2r)(const X(plan) p, R *in, R *out); \
313 \
314FFTW_EXTERN void X(destroy_plan)(X(plan) p); \
315FFTW_EXTERN void X(forget_wisdom)(void); \
316FFTW_EXTERN void X(cleanup)(void); \
317 \
318FFTW_EXTERN void X(set_timelimit)(double t); \
319 \
320FFTW_EXTERN void X(plan_with_nthreads)(int nthreads); \
321FFTW_EXTERN int X(init_threads)(void); \
322FFTW_EXTERN void X(cleanup_threads)(void); \
323FFTW_EXTERN void X(make_planner_thread_safe)(void); \
324 \
325FFTW_EXTERN int X(export_wisdom_to_filename)(const char *filename); \
326FFTW_EXTERN void X(export_wisdom_to_file)(FILE *output_file); \
327FFTW_EXTERN char *X(export_wisdom_to_string)(void); \
328FFTW_EXTERN void X(export_wisdom)(X(write_char_func) write_char, \
329 void *data); \
330FFTW_EXTERN int X(import_system_wisdom)(void); \
331FFTW_EXTERN int X(import_wisdom_from_filename)(const char *filename); \
332FFTW_EXTERN int X(import_wisdom_from_file)(FILE *input_file); \
333FFTW_EXTERN int X(import_wisdom_from_string)(const char *input_string); \
334FFTW_EXTERN int X(import_wisdom)(X(read_char_func) read_char, void *data); \
335 \
336FFTW_EXTERN void X(fprint_plan)(const X(plan) p, FILE *output_file); \
337FFTW_EXTERN void X(print_plan)(const X(plan) p); \
338FFTW_EXTERN char *X(sprint_plan)(const X(plan) p); \
339 \
340FFTW_EXTERN void *X(malloc)(size_t n); \
341FFTW_EXTERN R *X(alloc_real)(size_t n); \
342FFTW_EXTERN C *X(alloc_complex)(size_t n); \
343FFTW_EXTERN void X(free)(void *p); \
344 \
345FFTW_EXTERN void X(flops)(const X(plan) p, \
346 double *add, double *mul, double *fmas); \
347FFTW_EXTERN double X(estimate_cost)(const X(plan) p); \
348FFTW_EXTERN double X(cost)(const X(plan) p); \
349 \
350FFTW_EXTERN int X(alignment_of)(R *p); \
351FFTW_EXTERN const char X(version)[]; \
352FFTW_EXTERN const char X(cc)[]; \
353FFTW_EXTERN const char X(codelet_optim)[];
354
355
356/* end of FFTW_DEFINE_API macro */
357
358FFTW_DEFINE_API(FFTW_MANGLE_DOUBLE, double, fftw_complex)
359FFTW_DEFINE_API(FFTW_MANGLE_FLOAT, float, fftwf_complex)
360FFTW_DEFINE_API(FFTW_MANGLE_LONG_DOUBLE, long double, fftwl_complex)
361
362/* __float128 (quad precision) is a gcc extension on i386, x86_64, and ia64
363 for gcc >= 4.6 (compiled in FFTW with --enable-quad-precision) */
364#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) \
365 && !(defined(__ICC) || defined(__INTEL_COMPILER) || defined(__CUDACC__) || defined(__PGI)) \
366 && (defined(__i386__) || defined(__x86_64__) || defined(__ia64__))
367# if !defined(FFTW_NO_Complex) && defined(_Complex_I) && defined(complex) && defined(I)
368/* note: __float128 is a typedef, which is not supported with the _Complex
369 keyword in gcc, so instead we use this ugly __attribute__ version.
370 However, we can't simply pass the __attribute__ version to
371 FFTW_DEFINE_API because the __attribute__ confuses gcc in pointer
372 types. Hence redefining FFTW_DEFINE_COMPLEX. Ugh. */
373# undef FFTW_DEFINE_COMPLEX
374# define FFTW_DEFINE_COMPLEX(R, C) typedef _Complex float __attribute__((mode(TC))) C
375# endif
376FFTW_DEFINE_API(FFTW_MANGLE_QUAD, __float128, fftwq_complex)
377#endif
378
379#define FFTW_FORWARD (-1)
380#define FFTW_BACKWARD (+1)
381
382#define FFTW_NO_TIMELIMIT (-1.0)
383
384/* documented flags */
385#define FFTW_MEASURE (0U)
386#define FFTW_DESTROY_INPUT (1U << 0)
387#define FFTW_UNALIGNED (1U << 1)
388#define FFTW_CONSERVE_MEMORY (1U << 2)
389#define FFTW_EXHAUSTIVE (1U << 3) /* NO_EXHAUSTIVE is default */
390#define FFTW_PRESERVE_INPUT (1U << 4) /* cancels FFTW_DESTROY_INPUT */
391#define FFTW_PATIENT (1U << 5) /* IMPATIENT is default */
392#define FFTW_ESTIMATE (1U << 6)
393#define FFTW_WISDOM_ONLY (1U << 21)
394
395/* undocumented beyond-guru flags */
396#define FFTW_ESTIMATE_PATIENT (1U << 7)
397#define FFTW_BELIEVE_PCOST (1U << 8)
398#define FFTW_NO_DFT_R2HC (1U << 9)
399#define FFTW_NO_NONTHREADED (1U << 10)
400#define FFTW_NO_BUFFERING (1U << 11)
401#define FFTW_NO_INDIRECT_OP (1U << 12)
402#define FFTW_ALLOW_LARGE_GENERIC (1U << 13) /* NO_LARGE_GENERIC is default */
403#define FFTW_NO_RANK_SPLITS (1U << 14)
404#define FFTW_NO_VRANK_SPLITS (1U << 15)
405#define FFTW_NO_VRECURSE (1U << 16)
406#define FFTW_NO_SIMD (1U << 17)
407#define FFTW_NO_SLOW (1U << 18)
408#define FFTW_NO_FIXED_RADIX_LARGE_N (1U << 19)
409#define FFTW_ALLOW_PRUNING (1U << 20)
410
411#ifdef __cplusplus
412} /* extern "C" */
413#endif /* __cplusplus */
414
415#endif /* FFTW3_H */
Definition: fftw3.h:104
Definition: fftw3.h:97