source: CIVL/examples/omp/shtns/fftw3/fftw3.h@ 2131108

1.23 2.0 acw/focus-triggers main test-branch
Last change on this file since 2131108 was 2131108, checked in by Michael Rogers <mrogers08@…>, 11 years ago

Added shtns example for openmp

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@2642 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 16.8 KB
Line 
1/*
2 * Copyright (c) 2003, 2007-11 Matteo Frigo
3 * Copyright (c) 2003, 2007-11 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 #define FFTW_DLL
73 here and in kernel/ifftw.h if you are compiling/using FFTW as a
74 DLL, in order to do the proper importing/exporting, or
75 alternatively compile with -DFFTW_DLL or the equivalent
76 command-line flag. This is not necessary under MinGW/Cygwin, where
77 libtool does the imports/exports automatically. */
78#if defined(FFTW_DLL) && (defined(_WIN32) || defined(__WIN32__))
79 /* annoying Windows syntax for shared-library declarations */
80# if defined(COMPILING_FFTW) /* defined in api.h when compiling FFTW */
81# define FFTW_EXTERN extern __declspec(dllexport)
82# else /* user is calling FFTW; import symbol */
83# define FFTW_EXTERN extern __declspec(dllimport)
84# endif
85#else
86# define FFTW_EXTERN extern
87#endif
88
89enum fftw_r2r_kind_do_not_use_me {
90 FFTW_R2HC=0, FFTW_HC2R=1, FFTW_DHT=2,
91 FFTW_REDFT00=3, FFTW_REDFT01=4, FFTW_REDFT10=5, FFTW_REDFT11=6,
92 FFTW_RODFT00=7, FFTW_RODFT01=8, FFTW_RODFT10=9, FFTW_RODFT11=10
93};
94
95struct fftw_iodim_do_not_use_me {
96 int n; /* dimension size */
97 int is; /* input stride */
98 int os; /* output stride */
99};
100
101#include <stddef.h> /* for ptrdiff_t */
102struct fftw_iodim64_do_not_use_me {
103 ptrdiff_t n; /* dimension size */
104 ptrdiff_t is; /* input stride */
105 ptrdiff_t os; /* output stride */
106};
107
108typedef void (*fftw_write_char_func_do_not_use_me)(char c, void *);
109typedef int (*fftw_read_char_func_do_not_use_me)(void *);
110
111/*
112 huge second-order macro that defines prototypes for all API
113 functions. We expand this macro for each supported precision
114
115 X: name-mangling macro
116 R: real data type
117 C: complex data type
118*/
119
120#define FFTW_DEFINE_API(X, R, C) FFTW_DEFINE_COMPLEX(R, C);
121
122typedef struct X(plan_s) *X(plan);
123
124typedef struct fftw_iodim_do_not_use_me X(iodim);
125typedef struct fftw_iodim64_do_not_use_me X(iodim64);
126
127typedef enum fftw_r2r_kind_do_not_use_me X(r2r_kind);
128
129typedef fftw_write_char_func_do_not_use_me X(write_char_func);
130typedef fftw_read_char_func_do_not_use_me X(read_char_func);
131
132FFTW_EXTERN void X(execute)(const X(plan) p);
133
134FFTW_EXTERN X(plan) X(plan_dft)(int rank, const int *n,
135 C *in, C *out, int sign, unsigned flags);
136
137FFTW_EXTERN X(plan) X(plan_dft_1d)(int n, C *in, C *out, int sign,
138 unsigned flags);
139FFTW_EXTERN X(plan) X(plan_dft_2d)(int n0, int n1,
140 C *in, C *out, int sign, unsigned flags);
141FFTW_EXTERN X(plan) X(plan_dft_3d)(int n0, int n1, int n2,
142 C *in, C *out, int sign, unsigned flags);
143
144FFTW_EXTERN X(plan) X(plan_many_dft)(int rank, const int *n,
145 int howmany,
146 C *in, const int *inembed,
147 int istride, int idist,
148 C *out, const int *onembed,
149 int ostride, int odist,
150 int sign, unsigned flags);
151
152FFTW_EXTERN X(plan) X(plan_guru_dft)(int rank, const X(iodim) *dims,
153 int howmany_rank,
154 const X(iodim) *howmany_dims,
155 C *in, C *out,
156 int sign, unsigned flags);
157FFTW_EXTERN X(plan) X(plan_guru_split_dft)(int rank, const X(iodim) *dims,
158 int howmany_rank,
159 const X(iodim) *howmany_dims,
160 R *ri, R *ii, R *ro, R *io,
161 unsigned flags);
162
163FFTW_EXTERN X(plan) X(plan_guru64_dft)(int rank,
164 const X(iodim64) *dims,
165 int howmany_rank,
166 const X(iodim64) *howmany_dims,
167 C *in, C *out,
168 int sign, unsigned flags);
169FFTW_EXTERN X(plan) X(plan_guru64_split_dft)(int rank,
170 const X(iodim64) *dims,
171 int howmany_rank,
172 const X(iodim64) *howmany_dims,
173 R *ri, R *ii, R *ro, R *io,
174 unsigned flags);
175
176FFTW_EXTERN void X(execute_dft)(const X(plan) p, C *in, C *out);
177FFTW_EXTERN void X(execute_split_dft)(const X(plan) p, R *ri, R *ii,
178 R *ro, R *io);
179
180FFTW_EXTERN X(plan) X(plan_many_dft_r2c)(int rank, const int *n,
181 int howmany,
182 R *in, const int *inembed,
183 int istride, int idist,
184 C *out, const int *onembed,
185 int ostride, int odist,
186 unsigned flags);
187
188FFTW_EXTERN X(plan) X(plan_dft_r2c)(int rank, const int *n,
189 R *in, C *out, unsigned flags);
190
191FFTW_EXTERN X(plan) X(plan_dft_r2c_1d)(int n,R *in,C *out,unsigned flags);
192FFTW_EXTERN X(plan) X(plan_dft_r2c_2d)(int n0, int n1,
193 R *in, C *out, unsigned flags);
194FFTW_EXTERN X(plan) X(plan_dft_r2c_3d)(int n0, int n1,
195 int n2,
196 R *in, C *out, unsigned flags);
197
198
199FFTW_EXTERN X(plan) X(plan_many_dft_c2r)(int rank, const int *n,
200 int howmany,
201 C *in, const int *inembed,
202 int istride, int idist,
203 R *out, const int *onembed,
204 int ostride, int odist,
205 unsigned flags);
206
207FFTW_EXTERN X(plan) X(plan_dft_c2r)(int rank, const int *n,
208 C *in, R *out, unsigned flags);
209
210FFTW_EXTERN X(plan) X(plan_dft_c2r_1d)(int n,C *in,R *out,unsigned flags);
211FFTW_EXTERN X(plan) X(plan_dft_c2r_2d)(int n0, int n1,
212 C *in, R *out, unsigned flags);
213FFTW_EXTERN X(plan) X(plan_dft_c2r_3d)(int n0, int n1,
214 int n2,
215 C *in, R *out, unsigned flags);
216
217FFTW_EXTERN X(plan) X(plan_guru_dft_r2c)(int rank, const X(iodim) *dims,
218 int howmany_rank,
219 const X(iodim) *howmany_dims,
220 R *in, C *out,
221 unsigned flags);
222FFTW_EXTERN X(plan) X(plan_guru_dft_c2r)(int rank, const X(iodim) *dims,
223 int howmany_rank,
224 const X(iodim) *howmany_dims,
225 C *in, R *out,
226 unsigned flags);
227
228FFTW_EXTERN X(plan) X(plan_guru_split_dft_r2c)(
229 int rank, const X(iodim) *dims,
230 int howmany_rank,
231 const X(iodim) *howmany_dims,
232 R *in, R *ro, R *io,
233 unsigned flags);
234FFTW_EXTERN X(plan) X(plan_guru_split_dft_c2r)(
235 int rank, const X(iodim) *dims,
236 int howmany_rank,
237 const X(iodim) *howmany_dims,
238 R *ri, R *ii, R *out,
239 unsigned flags);
240
241FFTW_EXTERN X(plan) X(plan_guru64_dft_r2c)(int rank,
242 const X(iodim64) *dims,
243 int howmany_rank,
244 const X(iodim64) *howmany_dims,
245 R *in, C *out,
246 unsigned flags);
247FFTW_EXTERN X(plan) X(plan_guru64_dft_c2r)(int rank,
248 const X(iodim64) *dims,
249 int howmany_rank,
250 const X(iodim64) *howmany_dims,
251 C *in, R *out,
252 unsigned flags);
253
254FFTW_EXTERN X(plan) X(plan_guru64_split_dft_r2c)(
255 int rank, const X(iodim64) *dims,
256 int howmany_rank,
257 const X(iodim64) *howmany_dims,
258 R *in, R *ro, R *io,
259 unsigned flags);
260FFTW_EXTERN X(plan) X(plan_guru64_split_dft_c2r)(
261 int rank, const X(iodim64) *dims,
262 int howmany_rank,
263 const X(iodim64) *howmany_dims,
264 R *ri, R *ii, R *out,
265 unsigned flags);
266
267FFTW_EXTERN void X(execute_dft_r2c)(const X(plan) p, R *in, C *out);
268FFTW_EXTERN void X(execute_dft_c2r)(const X(plan) p, C *in, R *out);
269
270FFTW_EXTERN void X(execute_split_dft_r2c)(const X(plan) p,
271 R *in, R *ro, R *io);
272FFTW_EXTERN void X(execute_split_dft_c2r)(const X(plan) p,
273 R *ri, R *ii, R *out);
274
275FFTW_EXTERN X(plan) X(plan_many_r2r)(int rank, const int *n,
276 int howmany,
277 R *in, const int *inembed,
278 int istride, int idist,
279 R *out, const int *onembed,
280 int ostride, int odist,
281 const X(r2r_kind) *kind, unsigned flags);
282
283FFTW_EXTERN X(plan) X(plan_r2r)(int rank, const int *n, R *in, R *out,
284 const X(r2r_kind) *kind, unsigned flags);
285
286FFTW_EXTERN X(plan) X(plan_r2r_1d)(int n, R *in, R *out,
287 X(r2r_kind) kind, unsigned flags);
288FFTW_EXTERN X(plan) X(plan_r2r_2d)(int n0, int n1, R *in, R *out,
289 X(r2r_kind) kind0, X(r2r_kind) kind1,
290 unsigned flags);
291FFTW_EXTERN X(plan) X(plan_r2r_3d)(int n0, int n1, int n2,
292 R *in, R *out, X(r2r_kind) kind0,
293 X(r2r_kind) kind1, X(r2r_kind) kind2,
294 unsigned flags);
295
296FFTW_EXTERN X(plan) X(plan_guru_r2r)(int rank, const X(iodim) *dims,
297 int howmany_rank,
298 const X(iodim) *howmany_dims,
299 R *in, R *out,
300 const X(r2r_kind) *kind, unsigned flags);
301
302FFTW_EXTERN X(plan) X(plan_guru64_r2r)(int rank, const X(iodim64) *dims,
303 int howmany_rank,
304 const X(iodim64) *howmany_dims,
305 R *in, R *out,
306 const X(r2r_kind) *kind, unsigned flags);
307
308FFTW_EXTERN void X(execute_r2r)(const X(plan) p, R *in, R *out);
309
310FFTW_EXTERN void X(destroy_plan)(X(plan) p);
311FFTW_EXTERN void X(forget_wisdom)(void);
312FFTW_EXTERN void X(cleanup)(void);
313
314FFTW_EXTERN void X(set_timelimit)(double t);
315
316FFTW_EXTERN void X(plan_with_nthreads)(int nthreads);
317FFTW_EXTERN int X(init_threads)(void);
318FFTW_EXTERN void X(cleanup_threads)(void);
319
320FFTW_EXTERN int X(export_wisdom_to_filename)(const char *filename);
321FFTW_EXTERN void X(export_wisdom_to_file)(FILE *output_file);
322FFTW_EXTERN char *X(export_wisdom_to_string)(void);
323FFTW_EXTERN void X(export_wisdom)(X(write_char_func) write_char,
324 void *data);
325FFTW_EXTERN int X(import_system_wisdom)(void);
326FFTW_EXTERN int X(import_wisdom_from_filename)(const char *filename);
327FFTW_EXTERN int X(import_wisdom_from_file)(FILE *input_file);
328FFTW_EXTERN int X(import_wisdom_from_string)(const char *input_string);
329FFTW_EXTERN int X(import_wisdom)(X(read_char_func) read_char, void *data);
330
331FFTW_EXTERN void X(fprint_plan)(const X(plan) p, FILE *output_file);
332FFTW_EXTERN void X(print_plan)(const X(plan) p);
333
334FFTW_EXTERN void *X(malloc)(size_t n);
335FFTW_EXTERN R *X(alloc_real)(size_t n);
336FFTW_EXTERN C *X(alloc_complex)(size_t n);
337FFTW_EXTERN void X(free)(void *p);
338
339FFTW_EXTERN void X(flops)(const X(plan) p,
340 double *add, double *mul, double *fmas);
341FFTW_EXTERN double X(estimate_cost)(const X(plan) p);
342FFTW_EXTERN double X(cost)(const X(plan) p);
343
344FFTW_EXTERN const char X(version)[];
345FFTW_EXTERN const char X(cc)[];
346FFTW_EXTERN const char X(codelet_optim)[];
347
348
349/* end of FFTW_DEFINE_API macro */
350
351FFTW_DEFINE_API(FFTW_MANGLE_DOUBLE, double, fftw_complex)
352FFTW_DEFINE_API(FFTW_MANGLE_FLOAT, float, fftwf_complex)
353FFTW_DEFINE_API(FFTW_MANGLE_LONG_DOUBLE, long double, fftwl_complex)
354
355/* __float128 (quad precision) is a gcc extension on i386, x86_64, and ia64
356 for gcc >= 4.6 (compiled in FFTW with --enable-quad-precision) */
357#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
358 && !(defined(__ICC) || defined(__INTEL_COMPILER))
359 && (defined(__i386__) || defined(__x86_64__) || defined(__ia64__))
360# if !defined(FFTW_NO_Complex) && defined(_Complex_I) && defined(complex) && defined(I)
361/* note: __float128 is a typedef, which is not supported with the _Complex
362 keyword in gcc, so instead we use this ugly __attribute__ version.
363 However, we can't simply pass the __attribute__ version to
364 FFTW_DEFINE_API because the __attribute__ confuses gcc in pointer
365 types. Hence redefining FFTW_DEFINE_COMPLEX. Ugh. */
366# undef FFTW_DEFINE_COMPLEX
367# define FFTW_DEFINE_COMPLEX(R, C) typedef _Complex float __attribute__((mode(TC))) C
368# endif
369FFTW_DEFINE_API(FFTW_MANGLE_QUAD, __float128, fftwq_complex)
370#endif
371
372#define FFTW_FORWARD (-1)
373#define FFTW_BACKWARD (+1)
374
375#define FFTW_NO_TIMELIMIT (-1.0)
376
377/* documented flags */
378#define FFTW_MEASURE (0U)
379#define FFTW_DESTROY_INPUT (1U << 0)
380#define FFTW_UNALIGNED (1U << 1)
381#define FFTW_CONSERVE_MEMORY (1U << 2)
382#define FFTW_EXHAUSTIVE (1U << 3) /* NO_EXHAUSTIVE is default */
383#define FFTW_PRESERVE_INPUT (1U << 4) /* cancels FFTW_DESTROY_INPUT */
384#define FFTW_PATIENT (1U << 5) /* IMPATIENT is default */
385#define FFTW_ESTIMATE (1U << 6)
386#define FFTW_WISDOM_ONLY (1U << 21)
387
388/* undocumented beyond-guru flags */
389#define FFTW_ESTIMATE_PATIENT (1U << 7)
390#define FFTW_BELIEVE_PCOST (1U << 8)
391#define FFTW_NO_DFT_R2HC (1U << 9)
392#define FFTW_NO_NONTHREADED (1U << 10)
393#define FFTW_NO_BUFFERING (1U << 11)
394#define FFTW_NO_INDIRECT_OP (1U << 12)
395#define FFTW_ALLOW_LARGE_GENERIC (1U << 13) /* NO_LARGE_GENERIC is default */
396#define FFTW_NO_RANK_SPLITS (1U << 14)
397#define FFTW_NO_VRANK_SPLITS (1U << 15)
398#define FFTW_NO_VRECURSE (1U << 16)
399#define FFTW_NO_SIMD (1U << 17)
400#define FFTW_NO_SLOW (1U << 18)
401#define FFTW_NO_FIXED_RADIX_LARGE_N (1U << 19)
402#define FFTW_ALLOW_PRUNING (1U << 20)
403
404#ifdef __cplusplus
405} /* extern "C" */
406#endif /* __cplusplus */
407
408#endif /* FFTW3_H */
Note: See TracBrowser for help on using the repository browser.