some updates
[iv.d.git] / fftw3f.d
blobf341d153f7bfd2f494a7a0fc747b3003f7beb0f2
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.fftw3f;
32 pragma(lib, "fftw3f");
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(float, fftwf_complex);*/
74 alias fftwf_complex = float[2];
77 /*struct fftwf_plan_s *fftwf_plan;*/
78 alias fftwf_plan = void*;
81 typedef struct fftw_iodim_do_not_use_me fftwf_iodim;
82 typedef struct fftw_iodim64_do_not_use_me fftwf_iodim64;
84 typedef enum fftw_r2r_kind_do_not_use_me fftwf_r2r_kind;
86 typedef fftw_write_char_func_do_not_use_me fftwf_write_char_func;
87 typedef fftw_read_char_func_do_not_use_me fftwf_read_char_func;
90 alias fftwf_iodim = fftw_iodim_do_not_use_me;
91 alias fftwf_iodim64 = fftw_iodim64_do_not_use_me;
92 alias fftwf_r2r_kind = int;
94 void fftwf_execute(const fftwf_plan p);
96 fftwf_plan fftwf_plan_dft(int rank, const int *n,
97 fftwf_complex *in_, fftwf_complex *out_, int sign, uint flags);
99 fftwf_plan fftwf_plan_dft_1d(int n, fftwf_complex *in_, fftwf_complex *out_, int sign,
100 uint flags);
101 fftwf_plan fftwf_plan_dft_2d(int n0, int n1,
102 fftwf_complex *in_, fftwf_complex *out_, int sign, uint flags);
103 fftwf_plan fftwf_plan_dft_3d(int n0, int n1, int n2,
104 fftwf_complex *in_, fftwf_complex *out_, int sign, uint flags);
106 fftwf_plan fftwf_plan_many_dft(int rank, const int *n,
107 int howmany,
108 fftwf_complex *in_, const int *inembed,
109 int istride, int idist,
110 fftwf_complex *out_, const int *onembed,
111 int ostride, int odist,
112 int sign, uint flags);
114 fftwf_plan fftwf_plan_guru_dft(int rank, const fftwf_iodim *dims,
115 int howmany_rank,
116 const fftwf_iodim *howmany_dims,
117 fftwf_complex *in_, fftwf_complex *out_,
118 int sign, uint flags);
119 fftwf_plan fftwf_plan_guru_split_dft(int rank, const fftwf_iodim *dims,
120 int howmany_rank,
121 const fftwf_iodim *howmany_dims,
122 float *ri, float *ii, float *ro, float *io,
123 uint flags);
125 fftwf_plan fftwf_plan_guru64_dft(int rank,
126 const fftwf_iodim64 *dims,
127 int howmany_rank,
128 const fftwf_iodim64 *howmany_dims,
129 fftwf_complex *in_, fftwf_complex *out_,
130 int sign, uint flags);
131 fftwf_plan fftwf_plan_guru64_split_dft(int rank,
132 const fftwf_iodim64 *dims,
133 int howmany_rank,
134 const fftwf_iodim64 *howmany_dims,
135 float *ri, float *ii, float *ro, float *io,
136 uint flags);
138 void fftwf_execute_dft(const fftwf_plan p, fftwf_complex *in_, fftwf_complex *out_);
140 void fftwf_execute_split_dft(const fftwf_plan p, float *ri, float *ii,
141 float *ro, float *io);
143 fftwf_plan fftwf_plan_many_dft_r2c(int rank, const int *n,
144 int howmany,
145 float *in_, const int *inembed,
146 int istride, int idist,
147 fftwf_complex *out_, const int *onembed,
148 int ostride, int odist,
149 uint flags);
151 fftwf_plan fftwf_plan_dft_r2c(int rank, const int *n,
152 float *in_, fftwf_complex *out_, uint flags);
154 fftwf_plan fftwf_plan_dft_r2c_1d(int n,float *in_,fftwf_complex *out_,uint flags);
156 fftwf_plan fftwf_plan_dft_r2c_2d(int n0, int n1,
157 float *in_, fftwf_complex *out_, uint flags);
159 fftwf_plan fftwf_plan_dft_r2c_3d(int n0, int n1,
160 int n2,
161 float *in_, fftwf_complex *out_, uint flags);
163 fftwf_plan fftwf_plan_many_dft_c2r(int rank, const int *n,
164 int howmany,
165 fftwf_complex *in_, const int *inembed,
166 int istride, int idist,
167 float *out_, const int *onembed,
168 int ostride, int odist,
169 uint flags);
171 fftwf_plan fftwf_plan_dft_c2r(int rank, const int *n,
172 fftwf_complex *in_, float *out_, uint flags);
174 fftwf_plan fftwf_plan_dft_c2r_1d(int n,fftwf_complex *in_,float *out_,uint flags);
176 fftwf_plan fftwf_plan_dft_c2r_2d(int n0, int n1,
177 fftwf_complex *in_, float *out_, uint flags);
179 fftwf_plan fftwf_plan_dft_c2r_3d(int n0, int n1,
180 int n2,
181 fftwf_complex *in_, float *out_, uint flags);
183 fftwf_plan fftwf_plan_guru_dft_r2c(int rank, const fftwf_iodim *dims,
184 int howmany_rank,
185 const fftwf_iodim *howmany_dims,
186 float *in_, fftwf_complex *out_,
187 uint flags);
189 fftwf_plan fftwf_plan_guru_dft_c2r(int rank, const fftwf_iodim *dims,
190 int howmany_rank,
191 const fftwf_iodim *howmany_dims,
192 fftwf_complex *in_, float *out_,
193 uint flags);
195 fftwf_plan fftwf_plan_guru_split_dft_r2c(int rank, const fftwf_iodim *dims,
196 int howmany_rank,
197 const fftwf_iodim *howmany_dims,
198 float *in_, float *ro, float *io,
199 uint flags);
201 fftwf_plan fftwf_plan_guru_split_dft_c2r(int rank, const fftwf_iodim *dims,
202 int howmany_rank,
203 const fftwf_iodim *howmany_dims,
204 float *ri, float *ii, float *out_,
205 uint flags);
207 fftwf_plan fftwf_plan_guru64_dft_r2c(int rank,
208 const fftwf_iodim64 *dims,
209 int howmany_rank,
210 const fftwf_iodim64 *howmany_dims,
211 float *in_, fftwf_complex *out_,
212 uint flags);
214 fftwf_plan fftwf_plan_guru64_dft_c2r(int rank,
215 const fftwf_iodim64 *dims,
216 int howmany_rank,
217 const fftwf_iodim64 *howmany_dims,
218 fftwf_complex *in_, float *out_,
219 uint flags);
221 fftwf_plan fftwf_plan_guru64_split_dft_r2c(int rank, const fftwf_iodim64 *dims,
222 int howmany_rank,
223 const fftwf_iodim64 *howmany_dims,
224 float *in_, float *ro, float *io,
225 uint flags);
226 fftwf_plan fftwf_plan_guru64_split_dft_c2r(int rank, const fftwf_iodim64 *dims,
227 int howmany_rank,
228 const fftwf_iodim64 *howmany_dims,
229 float *ri, float *ii, float *out_,
230 uint flags);
232 void fftwf_execute_dft_r2c(const fftwf_plan p, float *in_, fftwf_complex *out_);
234 void fftwf_execute_dft_c2r(const fftwf_plan p, fftwf_complex *in_, float *out_);
236 void fftwf_execute_split_dft_r2c(const fftwf_plan p,
237 float *in_, float *ro, float *io);
239 void fftwf_execute_split_dft_c2r(const fftwf_plan p,
240 float *ri, float *ii, float *out_);
242 fftwf_plan fftwf_plan_many_r2r(int rank, const int *n,
243 int howmany,
244 float *in_, const int *inembed,
245 int istride, int idist,
246 float *out_, const int *onembed,
247 int ostride, int odist,
248 const fftwf_r2r_kind *kind, uint flags);
250 fftwf_plan fftwf_plan_r2r(int rank, const int *n, float *in_, float *out_,
251 const fftwf_r2r_kind *kind, uint flags);
253 fftwf_plan fftwf_plan_r2r_1d(int n, float *in_, float *out_,
254 fftwf_r2r_kind kind, uint flags);
256 fftwf_plan fftwf_plan_r2r_2d(int n0, int n1, float *in_, float *out_,
257 fftwf_r2r_kind kind0, fftwf_r2r_kind kind1,
258 uint flags);
260 fftwf_plan fftwf_plan_r2r_3d(int n0, int n1, int n2,
261 float *in_, float *out_, fftwf_r2r_kind kind0,
262 fftwf_r2r_kind kind1, fftwf_r2r_kind kind2,
263 uint flags);
265 fftwf_plan fftwf_plan_guru_r2r(int rank, const fftwf_iodim *dims,
266 int howmany_rank,
267 const fftwf_iodim *howmany_dims,
268 float *in_, float *out_,
269 const fftwf_r2r_kind *kind, uint flags);
271 fftwf_plan fftwf_plan_guru64_r2r(int rank, const fftwf_iodim64 *dims,
272 int howmany_rank,
273 const fftwf_iodim64 *howmany_dims,
274 float *in_, float *out_,
275 const fftwf_r2r_kind *kind, uint flags);
277 void fftwf_execute_r2r(const fftwf_plan p, float *in_, float *out_);
279 void fftwf_destroy_plan(fftwf_plan p);
281 void fftwf_forget_wisdom();
282 void fftwf_cleanup();
284 void fftwf_set_timelimit(double t);
286 void fftwf_plan_with_nthreads(int nthreads);
288 int fftwf_init_threads();
290 void fftwf_cleanup_threads();
292 void fftwf_make_planner_thread_safe();
294 int fftwf_export_wisdom_to_filename(const char *filename);
296 /*void fftwf_export_wisdom_to_file(FILE *output_file);*/
298 char * fftwf_export_wisdom_to_string();
300 /*void fftwf_export_wisdom(fftwf_write_char_func write_char, void *data);*/
301 int fftwf_import_system_wisdom();
303 int fftwf_import_wisdom_from_filename(const char *filename);
305 /*int fftwf_import_wisdom_from_file(FILE *input_file);*/
307 int fftwf_import_wisdom_from_string(const char *input_string);
309 /*int fftwf_import_wisdom(fftwf_read_char_func read_char, void *data);*/
311 /*void fftwf_fprint_plan(const fftwf_plan p, FILE *output_file);*/
313 void fftwf_print_plan(const fftwf_plan p);
315 char * fftwf_sprint_plan(const fftwf_plan p);
317 void * fftwf_malloc(size_t n);
319 float * fftwf_alloc_real(size_t n);
320 fftwf_complex * fftwf_alloc_complex(size_t n);
322 void fftwf_free(void *p);
324 void fftwf_flops(const fftwf_plan p,
325 double *add, double *mul, double *fmas);
326 double fftwf_estimate_cost(const fftwf_plan p);
328 double fftwf_cost(const fftwf_plan p);
330 int fftwf_alignment_of(float *p);
333 const char fftwf_version[];
334 const char fftwf_cc[];
335 const char fftwf_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;