some updates
[iv.d.git] / fftw3.d
blob684ef807a4116ca3164c5d025ad5e046739589f2
1 /*
2 * Copyright (c) 2003, 2007-14 Matteo Frigo
3 * Copyright (c) 2003, 2007-14 Massachusetts Institute of Technology
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:
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
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.
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.
31 module iv.fftw3;
32 pragma(lib, "fftw3");
33 extern(C) nothrow @trusted @nogc:
35 /***************************** NOTE TO USERS *********************************
37 * THIS IS A HEADER FILE, NOT A MANUAL
39 * If you want to know how to use FFTW, please read the manual,
40 * online at http://www.fftw.org/doc/ and also included with FFTW.
41 * For a quick start, see the manual's tutorial section.
43 * (Reading header files to learn how to use a library is a habit
44 * stemming from code lacking a proper manual. Arguably, it's a
45 * *bad* habit in most cases, because header files can contain
46 * interfaces that are not part of the public, stable API.)
48 ****************************************************************************/
50 alias fftw_r2r_kind_do_not_use_me = int;
51 enum : int {
52 FFTW_R2HC=0, FFTW_HC2R=1, FFTW_DHT=2,
53 FFTW_REDFT00=3, FFTW_REDFT01=4, FFTW_REDFT10=5, FFTW_REDFT11=6,
54 FFTW_RODFT00=7, FFTW_RODFT01=8, FFTW_RODFT10=9, FFTW_RODFT11=10,
57 struct fftw_iodim_do_not_use_me {
58 int n; /* dimension size */
59 int is_; /* input stride */
60 int os; /* output stride */
63 struct fftw_iodim64_do_not_use_me {
64 ptrdiff_t n; /* dimension size */
65 ptrdiff_t is_; /* input stride */
66 ptrdiff_t os; /* output stride */
69 //typedef void (FFTW_CDECL *fftw_write_char_func_do_not_use_me)(char c, void *);
70 //typedef int (FFTW_CDECL *fftw_read_char_func_do_not_use_me)(void *);
73 /*FFTW_DEFINE_COMPLEX(double, fftw_complex);*/
74 alias fftw_complex = double[2];
77 /*struct fftw_plan_s *fftw_plan;*/
78 alias fftw_plan = void*;
81 typedef struct fftw_iodim_do_not_use_me fftw_iodim;
82 typedef struct fftw_iodim64_do_not_use_me fftw_iodim64;
84 typedef enum fftw_r2r_kind_do_not_use_me fftw_r2r_kind;
86 typedef fftw_write_char_func_do_not_use_me fftw_write_char_func;
87 typedef fftw_read_char_func_do_not_use_me fftw_read_char_func;
90 alias fftw_iodim = fftw_iodim_do_not_use_me;
91 alias fftw_iodim64 = fftw_iodim64_do_not_use_me;
92 alias fftw_r2r_kind = int;
94 void fftw_execute(const fftw_plan p);
96 fftw_plan fftw_plan_dft(int rank, const int *n,
97 fftw_complex *in_, fftw_complex *out_, int sign, uint flags);
99 fftw_plan fftw_plan_dft_1d(int n, fftw_complex *in_, fftw_complex *out_, int sign,
100 uint flags);
101 fftw_plan fftw_plan_dft_2d(int n0, int n1,
102 fftw_complex *in_, fftw_complex *out_, int sign, uint flags);
103 fftw_plan fftw_plan_dft_3d(int n0, int n1, int n2,
104 fftw_complex *in_, fftw_complex *out_, int sign, uint flags);
106 fftw_plan fftw_plan_many_dft(int rank, const int *n,
107 int howmany,
108 fftw_complex *in_, const int *inembed,
109 int istride, int idist,
110 fftw_complex *out_, const int *onembed,
111 int ostride, int odist,
112 int sign, uint flags);
114 fftw_plan fftw_plan_guru_dft(int rank, const fftw_iodim *dims,
115 int howmany_rank,
116 const fftw_iodim *howmany_dims,
117 fftw_complex *in_, fftw_complex *out_,
118 int sign, uint flags);
119 fftw_plan fftw_plan_guru_split_dft(int rank, const fftw_iodim *dims,
120 int howmany_rank,
121 const fftw_iodim *howmany_dims,
122 double *ri, double *ii, double *ro, double *io,
123 uint flags);
125 fftw_plan fftw_plan_guru64_dft(int rank,
126 const fftw_iodim64 *dims,
127 int howmany_rank,
128 const fftw_iodim64 *howmany_dims,
129 fftw_complex *in_, fftw_complex *out_,
130 int sign, uint flags);
131 fftw_plan fftw_plan_guru64_split_dft(int rank,
132 const fftw_iodim64 *dims,
133 int howmany_rank,
134 const fftw_iodim64 *howmany_dims,
135 double *ri, double *ii, double *ro, double *io,
136 uint flags);
138 void fftw_execute_dft(const fftw_plan p, fftw_complex *in_, fftw_complex *out_);
140 void fftw_execute_split_dft(const fftw_plan p, double *ri, double *ii,
141 double *ro, double *io);
143 fftw_plan fftw_plan_many_dft_r2c(int rank, const int *n,
144 int howmany,
145 double *in_, const int *inembed,
146 int istride, int idist,
147 fftw_complex *out_, const int *onembed,
148 int ostride, int odist,
149 uint flags);
151 fftw_plan fftw_plan_dft_r2c(int rank, const int *n,
152 double *in_, fftw_complex *out_, uint flags);
154 fftw_plan fftw_plan_dft_r2c_1d(int n,double *in_,fftw_complex *out_,uint flags);
156 fftw_plan fftw_plan_dft_r2c_2d(int n0, int n1,
157 double *in_, fftw_complex *out_, uint flags);
159 fftw_plan fftw_plan_dft_r2c_3d(int n0, int n1,
160 int n2,
161 double *in_, fftw_complex *out_, uint flags);
163 fftw_plan fftw_plan_many_dft_c2r(int rank, const int *n,
164 int howmany,
165 fftw_complex *in_, const int *inembed,
166 int istride, int idist,
167 double *out_, const int *onembed,
168 int ostride, int odist,
169 uint flags);
171 fftw_plan fftw_plan_dft_c2r(int rank, const int *n,
172 fftw_complex *in_, double *out_, uint flags);
174 fftw_plan fftw_plan_dft_c2r_1d(int n,fftw_complex *in_,double *out_,uint flags);
176 fftw_plan fftw_plan_dft_c2r_2d(int n0, int n1,
177 fftw_complex *in_, double *out_, uint flags);
179 fftw_plan fftw_plan_dft_c2r_3d(int n0, int n1,
180 int n2,
181 fftw_complex *in_, double *out_, uint flags);
183 fftw_plan fftw_plan_guru_dft_r2c(int rank, const fftw_iodim *dims,
184 int howmany_rank,
185 const fftw_iodim *howmany_dims,
186 double *in_, fftw_complex *out_,
187 uint flags);
189 fftw_plan fftw_plan_guru_dft_c2r(int rank, const fftw_iodim *dims,
190 int howmany_rank,
191 const fftw_iodim *howmany_dims,
192 fftw_complex *in_, double *out_,
193 uint flags);
195 fftw_plan fftw_plan_guru_split_dft_r2c(int rank, const fftw_iodim *dims,
196 int howmany_rank,
197 const fftw_iodim *howmany_dims,
198 double *in_, double *ro, double *io,
199 uint flags);
201 fftw_plan fftw_plan_guru_split_dft_c2r(int rank, const fftw_iodim *dims,
202 int howmany_rank,
203 const fftw_iodim *howmany_dims,
204 double *ri, double *ii, double *out_,
205 uint flags);
207 fftw_plan fftw_plan_guru64_dft_r2c(int rank,
208 const fftw_iodim64 *dims,
209 int howmany_rank,
210 const fftw_iodim64 *howmany_dims,
211 double *in_, fftw_complex *out_,
212 uint flags);
214 fftw_plan fftw_plan_guru64_dft_c2r(int rank,
215 const fftw_iodim64 *dims,
216 int howmany_rank,
217 const fftw_iodim64 *howmany_dims,
218 fftw_complex *in_, double *out_,
219 uint flags);
221 fftw_plan fftw_plan_guru64_split_dft_r2c(int rank, const fftw_iodim64 *dims,
222 int howmany_rank,
223 const fftw_iodim64 *howmany_dims,
224 double *in_, double *ro, double *io,
225 uint flags);
226 fftw_plan fftw_plan_guru64_split_dft_c2r(int rank, const fftw_iodim64 *dims,
227 int howmany_rank,
228 const fftw_iodim64 *howmany_dims,
229 double *ri, double *ii, double *out_,
230 uint flags);
232 void fftw_execute_dft_r2c(const fftw_plan p, double *in_, fftw_complex *out_);
234 void fftw_execute_dft_c2r(const fftw_plan p, fftw_complex *in_, double *out_);
236 void fftw_execute_split_dft_r2c(const fftw_plan p,
237 double *in_, double *ro, double *io);
239 void fftw_execute_split_dft_c2r(const fftw_plan p,
240 double *ri, double *ii, double *out_);
242 fftw_plan fftw_plan_many_r2r(int rank, const int *n,
243 int howmany,
244 double *in_, const int *inembed,
245 int istride, int idist,
246 double *out_, const int *onembed,
247 int ostride, int odist,
248 const fftw_r2r_kind *kind, uint flags);
250 fftw_plan fftw_plan_r2r(int rank, const int *n, double *in_, double *out_,
251 const fftw_r2r_kind *kind, uint flags);
253 fftw_plan fftw_plan_r2r_1d(int n, double *in_, double *out_,
254 fftw_r2r_kind kind, uint flags);
256 fftw_plan fftw_plan_r2r_2d(int n0, int n1, double *in_, double *out_,
257 fftw_r2r_kind kind0, fftw_r2r_kind kind1,
258 uint flags);
260 fftw_plan fftw_plan_r2r_3d(int n0, int n1, int n2,
261 double *in_, double *out_, fftw_r2r_kind kind0,
262 fftw_r2r_kind kind1, fftw_r2r_kind kind2,
263 uint flags);
265 fftw_plan fftw_plan_guru_r2r(int rank, const fftw_iodim *dims,
266 int howmany_rank,
267 const fftw_iodim *howmany_dims,
268 double *in_, double *out_,
269 const fftw_r2r_kind *kind, uint flags);
271 fftw_plan fftw_plan_guru64_r2r(int rank, const fftw_iodim64 *dims,
272 int howmany_rank,
273 const fftw_iodim64 *howmany_dims,
274 double *in_, double *out_,
275 const fftw_r2r_kind *kind, uint flags);
277 void fftw_execute_r2r(const fftw_plan p, double *in_, double *out_);
279 void fftw_destroy_plan(fftw_plan p);
281 void fftw_forget_wisdom();
282 void fftw_cleanup();
284 void fftw_set_timelimit(double t);
286 void fftw_plan_with_nthreads(int nthreads);
288 int fftw_init_threads();
290 void fftw_cleanup_threads();
292 void fftw_make_planner_thread_safe();
294 int fftw_export_wisdom_to_filename(const char *filename);
296 /*void fftw_export_wisdom_to_file(FILE *output_file);*/
298 char * fftw_export_wisdom_to_string();
300 /*void fftw_export_wisdom(fftw_write_char_func write_char, void *data);*/
301 int fftw_import_system_wisdom();
303 int fftw_import_wisdom_from_filename(const char *filename);
305 /*int fftw_import_wisdom_from_file(FILE *input_file);*/
307 int fftw_import_wisdom_from_string(const char *input_string);
309 /*int fftw_import_wisdom(fftw_read_char_func read_char, void *data);*/
311 /*void fftw_fprint_plan(const fftw_plan p, FILE *output_file);*/
313 void fftw_print_plan(const fftw_plan p);
315 char * fftw_sprint_plan(const fftw_plan p);
317 void * fftw_malloc(size_t n);
319 double * fftw_alloc_real(size_t n);
320 fftw_complex * fftw_alloc_complex(size_t n);
322 void fftw_free(void *p);
324 void fftw_flops(const fftw_plan p,
325 double *add, double *mul, double *fmas);
326 double fftw_estimate_cost(const fftw_plan p);
328 double fftw_cost(const fftw_plan p);
330 int fftw_alignment_of(double *p);
333 const char fftw_version[];
334 const char fftw_cc[];
335 const char fftw_codelet_optim[];
339 enum FFTW_FORWARD = -1;
340 enum FFTW_BACKWARD = 1;
342 enum FFTW_NO_TIMELIMIT = -1.0;
344 /* documented flags */
345 enum FFTW_MEASURE = 0U;
346 enum FFTW_DESTROY_INPUT = 1U << 0;
347 enum FFTW_UNALIGNED = 1U << 1;
348 enum FFTW_CONSERVE_MEMORY = 1U << 2;
349 enum FFTW_EXHAUSTIVE = 1U << 3; /* NO_EXHAUSTIVE is default */
350 enum FFTW_PRESERVE_INPUT = 1U << 4; /* cancels FFTW_DESTROY_INPUT */
351 enum FFTW_PATIENT = 1U << 5; /* IMPATIENT is default */
352 enum FFTW_ESTIMATE = 1U << 6;
353 enum FFTW_WISDOM_ONLY = 1U << 21;
355 /* undocumented beyond-guru flags */
356 enum FFTW_ESTIMATE_PATIENT = 1U << 7;
357 enum FFTW_BELIEVE_PCOST = 1U << 8;
358 enum FFTW_NO_DFT_R2HC = 1U << 9;
359 enum FFTW_NO_NONTHREADED = 1U << 10;
360 enum FFTW_NO_BUFFERING = 1U << 11;
361 enum FFTW_NO_INDIRECT_OP = 1U << 12;
362 enum FFTW_ALLOW_LARGE_GENERIC = 1U << 13; /* NO_LARGE_GENERIC is default */
363 enum FFTW_NO_RANK_SPLITS = 1U << 14;
364 enum FFTW_NO_VRANK_SPLITS = 1U << 15;
365 enum FFTW_NO_VRECURSE = 1U << 16;
366 enum FFTW_NO_SIMD = 1U << 17;
367 enum FFTW_NO_SLOW = 1U << 18;
368 enum FFTW_NO_FIXED_RADIX_LARGE_N = 1U << 19;
369 enum FFTW_ALLOW_PRUNING = 1U << 20;