Bsoft  1.9
Bernard's software package
fftw.h
Go to the documentation of this file.
1 /* fftw/fftw.h. Generated by configure. */
2 /* -*- C -*- */
3 /*
4  * Copyright (c) 1997-1999, 2003 Massachusetts Institute of Technology
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  *
20  */
21 
22 /* fftw.h -- system-wide definitions */
23 /* $Id: fftw.h.in,v 1.57 2003/03/16 23:43:46 stevenj Exp $ */
24 
25 /* Define for using single precision */
26 /*
27  * If you can, use configure --enable-float instead of changing this
28  * flag directly
29  */
30 /* #undef FFTW_ENABLE_FLOAT */
31 /* Need to define this explicitly - JBH */
32 #define FFTW_ENABLE_FLOAT 1
33 
34 /* Also indicate version number here - JBH */
35 #define FFTW_VERSION "2.1.5"
36 
37 #ifndef FFTW_H
38 #define FFTW_H
39 
40 #include <stdlib.h>
41 #include <stdio.h>
42 
43 #ifdef __cplusplus
44 extern "C" {
45 #endif /* __cplusplus */
46 
47 /* our real numbers */
48 #ifdef FFTW_ENABLE_FLOAT
49 typedef float fftw_real;
50 #else
51 typedef double fftw_real;
52 #endif
53 
54 /*********************************************
55  * Complex numbers and operations
56  *********************************************/
57 typedef struct {
58  fftw_real re, im;
59 } fftw_complex;
60 #define c_re(c) ((c).re)
61 #define c_im(c) ((c).im)
62 
63 typedef enum {
66 
67 /* backward compatibility with FFTW-1.3 */
69 typedef fftw_real FFTW_REAL;
70 
71 #ifndef FFTW_1_0_COMPATIBILITY
72 #define FFTW_1_0_COMPATIBILITY 0
73 #endif
74 
75 #if FFTW_1_0_COMPATIBILITY
76 /* backward compatibility with FFTW-1.0 */
77 #define REAL fftw_real
78 #define COMPLEX fftw_complex
79 #endif
80 
81 /*********************************************
82  * Success or failure status
83  *********************************************/
84 
85 typedef enum {
87 } fftw_status;
88 
89 /*********************************************
90  * Codelets
91  *********************************************/
92 typedef void (fftw_notw_codelet)
93  (const fftw_complex *, fftw_complex *, int, int);
94 typedef void (fftw_twiddle_codelet)
95  (fftw_complex *, const fftw_complex *, int,
96  int, int);
97 typedef void (fftw_generic_codelet)
98  (fftw_complex *, const fftw_complex *, int,
99  int, int, int);
100 typedef void (fftw_real2hc_codelet)
101  (const fftw_real *, fftw_real *, fftw_real *,
102  int, int, int);
103 typedef void (fftw_hc2real_codelet)
104  (const fftw_real *, const fftw_real *,
105  fftw_real *, int, int, int);
106 typedef void (fftw_hc2hc_codelet)
107  (fftw_real *, const fftw_complex *,
108  int, int, int);
109 typedef void (fftw_rgeneric_codelet)
110  (fftw_real *, const fftw_complex *, int,
111  int, int, int);
112 
113 /*********************************************
114  * Configurations
115  *********************************************/
116 /*
117  * A configuration is a database of all known codelets
118  */
119 
123 };
124 
125 /* description of a codelet */
126 typedef struct {
127  const char *name; /* name of the codelet */
128  void (*codelet) (); /* pointer to the codelet itself */
129  int size; /* size of the codelet */
130  fftw_direction dir; /* direction */
131  enum fftw_node_type type; /* TWIDDLE or NO_TWIDDLE */
132  int signature; /* unique id */
133  int ntwiddle; /* number of twiddle factors */
134  const int *twiddle_order; /*
135  * array that determines the order
136  * in which the codelet expects
137  * the twiddle factors
138  */
140 
141 /* On Win32, you need to do funny things to access global variables
142  in shared libraries. Thanks to Andrew Sterian for this hack. */
143 #ifdef HAVE_WIN32
144 # if defined(BUILD_FFTW_DLL)
145 # define DL_IMPORT(type) __declspec(dllexport) type
146 # elif defined(USE_FFTW_DLL)
147 # define DL_IMPORT(type) __declspec(dllimport) type
148 # else
149 # define DL_IMPORT(type) type
150 # endif
151 #else
152 # define DL_IMPORT(type) type
153 #endif
154 
155 extern DL_IMPORT(const char *) fftw_version;
156 
157 /*****************************
158  * Plans
159  *****************************/
160 /*
161  * A plan is a sequence of reductions to compute a FFT of
162  * a given size. At each step, the FFT algorithm can:
163  *
164  * 1) apply a notw codelet, or
165  * 2) recurse and apply a twiddle codelet, or
166  * 3) apply the generic codelet.
167  */
168 
169 /* structure that contains twiddle factors */
170 typedef struct fftw_twiddle_struct {
171  int n;
173  fftw_complex *twarray;
174  struct fftw_twiddle_struct *next;
175  int refcnt;
176 } fftw_twiddle;
177 
178 typedef struct fftw_rader_data_struct {
180  fftw_complex *omega;
181  int g, ginv;
182  int p, flags, refcount;
186 
187 typedef void (fftw_rader_codelet)
188  (fftw_complex *, const fftw_complex *, int,
189  int, int, fftw_rader_data *);
190 
191 /* structure that holds all the data needed for a given step */
192 typedef struct fftw_plan_node_struct {
193  enum fftw_node_type type;
194 
195  union {
196  /* nodes of type FFTW_NOTW */
197  struct {
198  int size;
201  } notw;
202 
203  /* nodes of type FFTW_TWIDDLE */
204  struct {
205  int size;
210  } twiddle;
211 
212  /* nodes of type FFTW_GENERIC */
213  struct {
214  int size;
216  fftw_twiddle *tw;
218  } generic;
219 
220  /* nodes of type FFTW_RADER */
221  struct {
222  int size;
225  fftw_twiddle *tw;
227  } rader;
228 
229  /* nodes of type FFTW_REAL2HC */
230  struct {
231  int size;
234  } real2hc;
235 
236  /* nodes of type FFTW_HC2REAL */
237  struct {
238  int size;
241  } hc2real;
242 
243  /* nodes of type FFTW_HC2HC */
244  struct {
245  int size;
248  fftw_twiddle *tw;
251  } hc2hc;
252 
253  /* nodes of type FFTW_RGENERIC */
254  struct {
255  int size;
258  fftw_twiddle *tw;
260  } rgeneric;
261  } nodeu;
262 
263  int refcnt;
265 
266 typedef enum {
270 
272  int n;
273  int refcnt;
275  int flags;
277  enum fftw_node_type wisdom_type;
280  double cost;
283 };
284 
285 typedef struct fftw_plan_struct *fftw_plan;
286 
287 /* flags for the planner */
288 #define FFTW_ESTIMATE (0)
289 #define FFTW_MEASURE (1)
290 
291 #define FFTW_OUT_OF_PLACE (0)
292 #define FFTW_IN_PLACE (8)
293 #define FFTW_USE_WISDOM (16)
294 
295 #define FFTW_THREADSAFE (128) /* guarantee plan is read-only so that the
296  same plan can be used in parallel by
297  multiple threads */
298 
299 #define FFTWND_FORCE_BUFFERED (256) /* internal flag, forces buffering
300  in fftwnd transforms */
301 
302 #define FFTW_NO_VECTOR_RECURSE (512) /* internal flag, prevents use
303  of vector recursion */
304 
305 extern fftw_plan fftw_create_plan_specific(int n, fftw_direction dir,
306  int flags,
307  fftw_complex *in, int istride,
308  fftw_complex *out, int ostride);
309 #define FFTW_HAS_PLAN_SPECIFIC
310 extern fftw_plan fftw_create_plan(int n, fftw_direction dir, int flags);
311 extern void fftw_print_plan(fftw_plan plan);
312 extern void fftw_destroy_plan(fftw_plan plan);
313 extern void fftw(fftw_plan plan, int howmany, fftw_complex *in, int istride,
314  int idist, fftw_complex *out, int ostride, int odist);
315 extern void fftw_one(fftw_plan plan, fftw_complex *in, fftw_complex *out);
316 extern void fftw_die(const char *s);
317 extern void *fftw_malloc(size_t n);
318 extern void fftw_free(void *p);
319 extern void fftw_check_memory_leaks(void);
320 extern void fftw_print_max_memory_usage(void);
321 
322 typedef void *(*fftw_malloc_type_function) (size_t n);
323 typedef void (*fftw_free_type_function) (void *p);
324 typedef void (*fftw_die_type_function) (const char *errString);
328 
329 extern size_t fftw_sizeof_fftw_real(void);
330 
331 /* Wisdom: */
332 /*
333  * define this symbol so that users know we are using a version of FFTW
334  * with wisdom
335  */
336 #define FFTW_HAS_WISDOM
337 extern void fftw_forget_wisdom(void);
338 extern void fftw_export_wisdom(void (*emitter) (char c, void *), void *data);
339 extern fftw_status fftw_import_wisdom(int (*g) (void *), void *data);
340 extern void fftw_export_wisdom_to_file(FILE *output_file);
341 extern fftw_status fftw_import_wisdom_from_file(FILE *input_file);
342 extern char *fftw_export_wisdom_to_string(void);
343 extern fftw_status fftw_import_wisdom_from_string(const char *input_string);
344 
345 /*
346  * define symbol so we know this function is available (it is not in
347  * older FFTWs)
348  */
349 #define FFTW_HAS_FPRINT_PLAN
350 extern void fftw_fprint_plan(FILE *f, fftw_plan plan);
351 
352 /*****************************
353  * N-dimensional code
354  *****************************/
355 typedef struct {
356  int is_in_place; /* 1 if for in-place FFTs, 0 otherwise */
357 
358  int rank; /*
359  * the rank (number of dimensions) of the
360  * array to be FFTed
361  */
362  int *n; /*
363  * the dimensions of the array to the
364  * FFTed
365  */
367 
368  int *n_before; /*
369  * n_before[i] = product of n[j] for j < i
370  */
371  int *n_after; /* n_after[i] = product of n[j] for j > i */
372 
373  fftw_plan *plans; /* 1d fftw plans for each dimension */
374 
375  int nbuffers, nwork;
376  fftw_complex *work; /*
377  * work array big enough to hold
378  * nbuffers+1 of the largest dimension
379  * (has nwork elements)
380  */
381 } fftwnd_data;
382 
384 
385 /* Initializing the FFTWND plan: */
386 extern fftwnd_plan fftw2d_create_plan(int nx, int ny, fftw_direction dir,
387  int flags);
388 extern fftwnd_plan fftw3d_create_plan(int nx, int ny, int nz,
389  fftw_direction dir, int flags);
390 extern fftwnd_plan fftwnd_create_plan(int rank, const int *n,
392  int flags);
393 
394 extern fftwnd_plan fftw2d_create_plan_specific(int nx, int ny,
396  int flags,
397  fftw_complex *in, int istride,
398  fftw_complex *out, int ostride);
399 extern fftwnd_plan fftw3d_create_plan_specific(int nx, int ny, int nz,
400  fftw_direction dir, int flags,
401  fftw_complex *in, int istride,
402  fftw_complex *out, int ostride);
403 extern fftwnd_plan fftwnd_create_plan_specific(int rank, const int *n,
405  int flags,
406  fftw_complex *in, int istride,
407  fftw_complex *out, int ostride);
408 
409 /* Freeing the FFTWND plan: */
410 extern void fftwnd_destroy_plan(fftwnd_plan plan);
411 
412 /* Printing the plan: */
413 extern void fftwnd_fprint_plan(FILE *f, fftwnd_plan p);
414 extern void fftwnd_print_plan(fftwnd_plan p);
415 #define FFTWND_HAS_PRINT_PLAN
416 
417 /* Computing the N-Dimensional FFT */
418 extern void fftwnd(fftwnd_plan plan, int howmany,
419  fftw_complex *in, int istride, int idist,
420  fftw_complex *out, int ostride, int odist);
421 extern void fftwnd_one(fftwnd_plan p, fftw_complex *in, fftw_complex *out);
422 
423 #ifdef __cplusplus
424 } /* extern "C" */
425 
426 #endif /* __cplusplus */
427 #endif /* FFTW_H */
struct fftw_rader_data_struct * next
Definition: fftw.h:183
double cost
Definition: fftw.h:280
const fftw_codelet_desc * cdesc
Definition: fftw.h:172
fftw_complex * omega
Definition: fftw.h:180
fftw_complex FFTW_COMPLEX
Definition: fftw.h:68
fftw_die_type_function fftw_die_hook
Definition: malloc.c:35
union fftw_plan_node_struct::@0 nodeu
fftw_real2hc_codelet * codelet
Definition: fftw.h:232
void( fftw_twiddle_codelet)(fftw_complex *, const fftw_complex *, int, int, int)
Definition: fftw.h:95
void( fftw_rader_codelet)(fftw_complex *, const fftw_complex *, int, int, int, fftw_rader_data *)
Definition: fftw.h:188
void fftw(fftw_plan plan, int howmany, fftw_complex *in, int istride, int idist, fftw_complex *out, int ostride, int odist)
Definition: executor.c:402
void fftwnd_print_plan(fftwnd_plan p)
Definition: fftwnd.c:539
fftw_free_type_function fftw_free_hook
Definition: malloc.c:34
fftwnd_plan fftw2d_create_plan_specific(int nx, int ny, fftw_direction dir, int flags, fftw_complex *in, int istride, fftw_complex *out, int ostride)
Definition: fftwnd.c:414
void *(* fftw_malloc_type_function)(size_t n)
Definition: fftw.h:322
fftw_real FFTW_REAL
Definition: fftw.h:69
void(* fftw_die_type_function)(const char *errString)
Definition: fftw.h:324
fftw_hc2hc_codelet * codelet
Definition: fftw.h:247
const int * twiddle_order
Definition: fftw.h:134
const char * name
Definition: fftw.h:127
struct fftw_plan_node_struct fftw_plan_node
const fftw_codelet_desc * codelet_desc
Definition: fftw.h:200
struct fftw_plan_node_struct::@0::@4 rader
void( fftw_hc2hc_codelet)(fftw_real *, const fftw_complex *, int, int, int)
Definition: fftw.h:107
void( fftw_real2hc_codelet)(const fftw_real *, fftw_real *, fftw_real *, int, int, int)
Definition: fftw.h:101
fftw_real re
Definition: fftw.h:58
fftw_generic_codelet * codelet
Definition: fftw.h:215
struct fftw_plan_struct * next
Definition: fftw.h:278
void fftw_free(void *p)
Definition: malloc.c:178
int * n_before
Definition: fftw.h:368
void fftw_die(const char *s)
Definition: malloc.c:192
fftw_recurse_kind recurse_kind
Definition: fftw.h:281
struct fftw_plan_struct * plan
Definition: fftw.h:179
void( fftw_generic_codelet)(fftw_complex *, const fftw_complex *, int, int, int, int)
Definition: fftw.h:98
void fftw_fprint_plan(FILE *f, fftw_plan plan)
Definition: putils.c:536
void fftw_export_wisdom(void(*emitter)(char c, void *), void *data)
Definition: wisdom.c:158
struct fftw_plan_node_struct::@0::@5 real2hc
fftw_plan_node * root
Definition: fftw.h:279
void fftwnd_destroy_plan(fftwnd_plan plan)
Definition: fftwnd.c:481
fftw_node_type
Definition: fftw.h:120
int is_in_place
Definition: fftw.h:356
fftw_notw_codelet * codelet
Definition: fftw.h:199
void( fftw_notw_codelet)(const fftw_complex *, fftw_complex *, int, int)
Definition: fftw.h:93
void( fftw_hc2real_codelet)(const fftw_real *, const fftw_real *, fftw_real *, int, int, int)
Definition: fftw.h:104
void fftwnd_one(fftwnd_plan p, fftw_complex *in, fftw_complex *out)
Definition: fftwnd.c:803
fftwnd_plan fftwnd_create_plan(int rank, const int *n, fftw_direction dir, int flags)
Definition: fftwnd.c:445
void fftw_destroy_plan(fftw_plan plan)
Definition: planner.c:472
size_t fftw_sizeof_fftw_real(void)
Definition: putils.c:552
fftw_status fftw_import_wisdom_from_file(FILE *input_file)
Definition: wisdomio.c:43
void * fftw_malloc(size_t n)
Definition: malloc.c:160
fftw_recurse_kind
Definition: fftw.h:266
fftw_codelet_desc * cdesc
Definition: fftw.h:184
int nwork
Definition: fftw.h:375
fftw_direction dir
Definition: fftw.h:246
struct fftw_plan_node_struct::@0::@7 hc2hc
fftw_rader_codelet * codelet
Definition: fftw.h:223
struct fftw_twiddle_struct * next
Definition: fftw.h:174
struct fftw_plan_node_struct::@0::@6 hc2real
void(* fftw_free_type_function)(void *p)
Definition: fftw.h:323
void fftw_print_plan(fftw_plan plan)
Definition: putils.c:547
fftw_complex * work
Definition: fftw.h:376
fftwnd_data * fftwnd_plan
Definition: fftw.h:383
fftw_rgeneric_codelet * codelet
Definition: fftw.h:257
fftw_rader_data * rader_data
Definition: fftw.h:224
struct fftw_plan_node_struct::@0::@8 rgeneric
fftw_malloc_type_function fftw_malloc_hook
Definition: malloc.c:33
void fftw_export_wisdom_to_file(FILE *output_file)
Definition: wisdomio.c:32
int vector_size
Definition: fftw.h:282
char * fftw_export_wisdom_to_string(void)
Definition: wisdomio.c:67
struct fftw_plan_node_struct::@0::@2 twiddle
fftw_twiddle * tw
Definition: fftw.h:207
struct fftw_rader_data_struct fftw_rader_data
fftw_plan * plans
Definition: fftw.h:373
void fftwnd_fprint_plan(FILE *f, fftwnd_plan p)
Definition: fftwnd.c:504
const char * fftw_version
Definition: executor.c:29
fftw_direction dir
Definition: fftw.h:366
fftw_complex * twarray
Definition: fftw.h:173
void( fftw_rgeneric_codelet)(fftw_real *, const fftw_complex *, int, int, int, int)
Definition: fftw.h:110
fftw_direction dir
Definition: fftw.h:130
fftw_direction dir
Definition: fftw.h:274
fftw_status
Definition: fftw.h:85
int * n
Definition: fftw.h:362
struct fftw_plan_struct * fftw_plan
Definition: fftw.h:285
fftwnd_plan fftw3d_create_plan(int nx, int ny, int nz, fftw_direction dir, int flags)
Definition: fftwnd.c:457
fftw_plan fftw_create_plan(int n, fftw_direction dir, int flags)
Definition: planner.c:450
JSAMPIMAGE data
Definition: jpeglib.h:945
int * n_after
Definition: fftw.h:371
void fftw_one(fftw_plan plan, fftw_complex *in, fftw_complex *out)
Definition: executor.c:455
void fftw_print_max_memory_usage(void)
Definition: malloc.c:233
float fftw_real
Definition: fftw.h:49
struct fftw_plan_node_struct * recurse
Definition: fftw.h:208
void fftw_check_memory_leaks(void)
Definition: malloc.c:203
struct fftw_twiddle_struct fftw_twiddle
fftw_status fftw_import_wisdom(int(*g)(void *), void *data)
Definition: wisdom.c:262
fftwnd_plan fftw2d_create_plan(int nx, int ny, fftw_direction dir, int flags)
Definition: fftwnd.c:451
void fftw_forget_wisdom(void)
Definition: wisdom.c:125
void fftwnd(fftwnd_plan plan, int howmany, fftw_complex *in, int istride, int idist, fftw_complex *out, int ostride, int odist)
Definition: fftwnd.c:746
fftw_hc2real_codelet * codelet
Definition: fftw.h:239
fftw_direction
Definition: fftw.h:63
fftw_plan fftw_create_plan_specific(int n, fftw_direction dir, int flags, fftw_complex *in, int istride, fftw_complex *out, int ostride)
Definition: planner.c:421
fftwnd_plan fftw3d_create_plan_specific(int nx, int ny, int nz, fftw_direction dir, int flags, fftw_complex *in, int istride, fftw_complex *out, int ostride)
Definition: fftwnd.c:428
int wisdom_signature
Definition: fftw.h:276
fftw_twiddle_codelet * codelet
Definition: fftw.h:206
#define DL_IMPORT(type)
Definition: fftw.h:152
int rank
Definition: fftw.h:358
fftw_status fftw_import_wisdom_from_string(const char *input_string)
Definition: wisdomio.c:97
fftwnd_plan fftwnd_create_plan_specific(int rank, const int *n, fftw_direction dir, int flags, fftw_complex *in, int istride, fftw_complex *out, int ostride)
Definition: fftwnd.c:307