tomoRecon 1-0
/home/epics/devel/tomoRecon/tomoReconApp/src/fftw3.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2003, 2007-8 Matteo Frigo
00003  * Copyright (c) 2003, 2007-8 Massachusetts Institute of Technology
00004  *
00005  * The following statement of license applies *only* to this header file,
00006  * and *not* to the other files distributed with FFTW or derived therefrom:
00007  * 
00008  * Redistribution and use in source and binary forms, with or without
00009  * modification, are permitted provided that the following conditions
00010  * are met:
00011  *
00012  * 1. Redistributions of source code must retain the above copyright
00013  *    notice, this list of conditions and the following disclaimer.
00014  *
00015  * 2. Redistributions in binary form must reproduce the above copyright
00016  *    notice, this list of conditions and the following disclaimer in the
00017  *    documentation and/or other materials provided with the distribution.
00018  *
00019  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
00020  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00021  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00022  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
00023  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00024  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
00025  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00026  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
00027  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00028  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00029  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00030  */
00031 
00032 /***************************** NOTE TO USERS *********************************
00033  *
00034  *                 THIS IS A HEADER FILE, NOT A MANUAL
00035  *
00036  *    If you want to know how to use FFTW, please read the manual,
00037  *    online at http://www.fftw.org/doc/ and also included with FFTW.
00038  *    For a quick start, see the manual's tutorial section.
00039  *
00040  *   (Reading header files to learn how to use a library is a habit
00041  *    stemming from code lacking a proper manual.  Arguably, it's a
00042  *    *bad* habit in most cases, because header files can contain
00043  *    interfaces that are not part of the public, stable API.)
00044  *
00045  ****************************************************************************/
00046 
00047 #ifndef FFTW3_H
00048 #define FFTW3_H
00049 
00050 #include <stdio.h>
00051 
00052 #ifdef __cplusplus
00053 extern "C"
00054 {
00055 #endif /* __cplusplus */
00056 
00057 /* If <complex.h> is included, use the C99 complex type.  Otherwise
00058    define a type bit-compatible with C99 complex */
00059 #if !defined(FFTW_NO_Complex) && defined(_Complex_I) && defined(complex) && defined(I)
00060 #  define FFTW_DEFINE_COMPLEX(R, C) typedef R _Complex C
00061 #else
00062 #  define FFTW_DEFINE_COMPLEX(R, C) typedef R C[2]
00063 #endif
00064 
00065 #define FFTW_CONCAT(prefix, name) prefix ## name
00066 #define FFTW_MANGLE_DOUBLE(name) FFTW_CONCAT(fftw_, name)
00067 #define FFTW_MANGLE_FLOAT(name) FFTW_CONCAT(fftwf_, name)
00068 #define FFTW_MANGLE_LONG_DOUBLE(name) FFTW_CONCAT(fftwl_, name)
00069 
00070 /* IMPORTANT: for Windows compilers, you should add a line
00071 */
00072 #define FFTW_DLL
00073 /*
00074    here and in kernel/ifftw.h if you are compiling/using FFTW as a
00075    DLL, in order to do the proper importing/exporting, or
00076    alternatively compile with -DFFTW_DLL or the equivalent
00077    command-line flag.  This is not necessary under MinGW/Cygwin, where
00078    libtool does the imports/exports automatically. */
00079 #if defined(FFTW_DLL) && (defined(_WIN32) || defined(__WIN32__))
00080    /* annoying Windows syntax for shared-library declarations */
00081 #  if defined(COMPILING_FFTW) /* defined in api.h when compiling FFTW */
00082 #    define FFTW_EXTERN extern __declspec(dllexport) 
00083 #  else /* user is calling FFTW; import symbol */
00084 #    define FFTW_EXTERN extern __declspec(dllimport) 
00085 #  endif
00086 #else
00087 #  define FFTW_EXTERN extern
00088 #endif
00089 
00090 enum fftw_r2r_kind_do_not_use_me {
00091      FFTW_R2HC=0, FFTW_HC2R=1, FFTW_DHT=2,
00092      FFTW_REDFT00=3, FFTW_REDFT01=4, FFTW_REDFT10=5, FFTW_REDFT11=6,
00093      FFTW_RODFT00=7, FFTW_RODFT01=8, FFTW_RODFT10=9, FFTW_RODFT11=10
00094 };
00095 
00096 struct fftw_iodim_do_not_use_me {
00097      int n;                     /* dimension size */
00098      int is;                    /* input stride */
00099      int os;                    /* output stride */
00100 };
00101 
00102 #include <stddef.h> /* for ptrdiff_t */
00103 struct fftw_iodim64_do_not_use_me {
00104      ptrdiff_t n;                     /* dimension size */
00105      ptrdiff_t is;                      /* input stride */
00106      ptrdiff_t os;                      /* output stride */
00107 };
00108 
00109 /*
00110   huge second-order macro that defines prototypes for all API
00111   functions.  We expand this macro for each supported precision
00112  
00113   X: name-mangling macro
00114   R: real data type
00115   C: complex data type
00116 */
00117 
00118 #define FFTW_DEFINE_API(X, R, C)                                           \
00119                                                                            \
00120 FFTW_DEFINE_COMPLEX(R, C);                                                 \
00121                                                                            \
00122 typedef struct X(plan_s) *X(plan);                                         \
00123                                                                            \
00124 typedef struct fftw_iodim_do_not_use_me X(iodim);                          \
00125 typedef struct fftw_iodim64_do_not_use_me X(iodim64);                      \
00126                                                                            \
00127 typedef enum fftw_r2r_kind_do_not_use_me X(r2r_kind);                      \
00128                                                                            \
00129 FFTW_EXTERN void X(execute)(const X(plan) p);                              \
00130                                                                            \
00131 FFTW_EXTERN X(plan) X(plan_dft)(int rank, const int *n,                    \
00132                     C *in, C *out, int sign, unsigned flags);              \
00133                                                                            \
00134 FFTW_EXTERN X(plan) X(plan_dft_1d)(int n, C *in, C *out, int sign,         \
00135                        unsigned flags);                                    \
00136 FFTW_EXTERN X(plan) X(plan_dft_2d)(int n0, int n1,                         \
00137                        C *in, C *out, int sign, unsigned flags);           \
00138 FFTW_EXTERN X(plan) X(plan_dft_3d)(int n0, int n1, int n2,                 \
00139                        C *in, C *out, int sign, unsigned flags);           \
00140                                                                            \
00141 FFTW_EXTERN X(plan) X(plan_many_dft)(int rank, const int *n,               \
00142                          int howmany,                                      \
00143                          C *in, const int *inembed,                        \
00144                          int istride, int idist,                           \
00145                          C *out, const int *onembed,                       \
00146                          int ostride, int odist,                           \
00147                          int sign, unsigned flags);                        \
00148                                                                            \
00149 FFTW_EXTERN X(plan) X(plan_guru_dft)(int rank, const X(iodim) *dims,       \
00150                          int howmany_rank,                                 \
00151                          const X(iodim) *howmany_dims,                     \
00152                          C *in, C *out,                                    \
00153                          int sign, unsigned flags);                        \
00154 FFTW_EXTERN X(plan) X(plan_guru_split_dft)(int rank, const X(iodim) *dims, \
00155                          int howmany_rank,                                 \
00156                          const X(iodim) *howmany_dims,                     \
00157                          R *ri, R *ii, R *ro, R *io,                       \
00158                          unsigned flags);                                  \
00159                                                                            \
00160 FFTW_EXTERN X(plan) X(plan_guru64_dft)(int rank,                           \
00161                          const X(iodim64) *dims,                           \
00162                          int howmany_rank,                                 \
00163                          const X(iodim64) *howmany_dims,                   \
00164                          C *in, C *out,                                    \
00165                          int sign, unsigned flags);                        \
00166 FFTW_EXTERN X(plan) X(plan_guru64_split_dft)(int rank,                     \
00167                          const X(iodim64) *dims,                           \
00168                          int howmany_rank,                                 \
00169                          const X(iodim64) *howmany_dims,                   \
00170                          R *ri, R *ii, R *ro, R *io,                       \
00171                          unsigned flags);                                  \
00172                                                                            \
00173 FFTW_EXTERN void X(execute_dft)(const X(plan) p, C *in, C *out);           \
00174 FFTW_EXTERN void X(execute_split_dft)(const X(plan) p, R *ri, R *ii,       \
00175                                       R *ro, R *io);                       \
00176                                                                            \
00177 FFTW_EXTERN X(plan) X(plan_many_dft_r2c)(int rank, const int *n,           \
00178                              int howmany,                                  \
00179                              R *in, const int *inembed,                    \
00180                              int istride, int idist,                       \
00181                              C *out, const int *onembed,                   \
00182                              int ostride, int odist,                       \
00183                              unsigned flags);                              \
00184                                                                            \
00185 FFTW_EXTERN X(plan) X(plan_dft_r2c)(int rank, const int *n,                \
00186                         R *in, C *out, unsigned flags);                    \
00187                                                                            \
00188 FFTW_EXTERN X(plan) X(plan_dft_r2c_1d)(int n,R *in,C *out,unsigned flags); \
00189 FFTW_EXTERN X(plan) X(plan_dft_r2c_2d)(int n0, int n1,                     \
00190                            R *in, C *out, unsigned flags);                 \
00191 FFTW_EXTERN X(plan) X(plan_dft_r2c_3d)(int n0, int n1,                     \
00192                            int n2,                                         \
00193                            R *in, C *out, unsigned flags);                 \
00194                                                                            \
00195                                                                            \
00196 FFTW_EXTERN X(plan) X(plan_many_dft_c2r)(int rank, const int *n,           \
00197                              int howmany,                                  \
00198                              C *in, const int *inembed,                    \
00199                              int istride, int idist,                       \
00200                              R *out, const int *onembed,                   \
00201                              int ostride, int odist,                       \
00202                              unsigned flags);                              \
00203                                                                            \
00204 FFTW_EXTERN X(plan) X(plan_dft_c2r)(int rank, const int *n,                \
00205                         C *in, R *out, unsigned flags);                    \
00206                                                                            \
00207 FFTW_EXTERN X(plan) X(plan_dft_c2r_1d)(int n,C *in,R *out,unsigned flags); \
00208 FFTW_EXTERN X(plan) X(plan_dft_c2r_2d)(int n0, int n1,                     \
00209                            C *in, R *out, unsigned flags);                 \
00210 FFTW_EXTERN X(plan) X(plan_dft_c2r_3d)(int n0, int n1,                     \
00211                            int n2,                                         \
00212                            C *in, R *out, unsigned flags);                 \
00213                                                                            \
00214 FFTW_EXTERN X(plan) X(plan_guru_dft_r2c)(int rank, const X(iodim) *dims,   \
00215                              int howmany_rank,                             \
00216                              const X(iodim) *howmany_dims,                 \
00217                              R *in, C *out,                                \
00218                              unsigned flags);                              \
00219 FFTW_EXTERN X(plan) X(plan_guru_dft_c2r)(int rank, const X(iodim) *dims,   \
00220                              int howmany_rank,                             \
00221                              const X(iodim) *howmany_dims,                 \
00222                              C *in, R *out,                                \
00223                              unsigned flags);                              \
00224                                                                            \
00225 FFTW_EXTERN X(plan) X(plan_guru_split_dft_r2c)(                            \
00226                              int rank, const X(iodim) *dims,               \
00227                              int howmany_rank,                             \
00228                              const X(iodim) *howmany_dims,                 \
00229                              R *in, R *ro, R *io,                          \
00230                              unsigned flags);                              \
00231 FFTW_EXTERN X(plan) X(plan_guru_split_dft_c2r)(                            \
00232                              int rank, const X(iodim) *dims,               \
00233                              int howmany_rank,                             \
00234                              const X(iodim) *howmany_dims,                 \
00235                              R *ri, R *ii, R *out,                         \
00236                              unsigned flags);                              \
00237                                                                            \
00238 FFTW_EXTERN X(plan) X(plan_guru64_dft_r2c)(int rank,                       \
00239                              const X(iodim64) *dims,                       \
00240                              int howmany_rank,                             \
00241                              const X(iodim64) *howmany_dims,               \
00242                              R *in, C *out,                                \
00243                              unsigned flags);                              \
00244 FFTW_EXTERN X(plan) X(plan_guru64_dft_c2r)(int rank,                       \
00245                              const X(iodim64) *dims,                       \
00246                              int howmany_rank,                             \
00247                              const X(iodim64) *howmany_dims,               \
00248                              C *in, R *out,                                \
00249                              unsigned flags);                              \
00250                                                                            \
00251 FFTW_EXTERN X(plan) X(plan_guru64_split_dft_r2c)(                          \
00252                              int rank, const X(iodim64) *dims,             \
00253                              int howmany_rank,                             \
00254                              const X(iodim64) *howmany_dims,               \
00255                              R *in, R *ro, R *io,                          \
00256                              unsigned flags);                              \
00257 FFTW_EXTERN X(plan) X(plan_guru64_split_dft_c2r)(                          \
00258                              int rank, const X(iodim64) *dims,             \
00259                              int howmany_rank,                             \
00260                              const X(iodim64) *howmany_dims,               \
00261                              R *ri, R *ii, R *out,                         \
00262                              unsigned flags);                              \
00263                                                                            \
00264 FFTW_EXTERN void X(execute_dft_r2c)(const X(plan) p, R *in, C *out);       \
00265 FFTW_EXTERN void X(execute_dft_c2r)(const X(plan) p, C *in, R *out);       \
00266                                                                            \
00267 FFTW_EXTERN void X(execute_split_dft_r2c)(const X(plan) p,                 \
00268                                           R *in, R *ro, R *io);            \
00269 FFTW_EXTERN void X(execute_split_dft_c2r)(const X(plan) p,                 \
00270                                           R *ri, R *ii, R *out);           \
00271                                                                            \
00272 FFTW_EXTERN X(plan) X(plan_many_r2r)(int rank, const int *n,               \
00273                          int howmany,                                      \
00274                          R *in, const int *inembed,                        \
00275                          int istride, int idist,                           \
00276                          R *out, const int *onembed,                       \
00277                          int ostride, int odist,                           \
00278                          const X(r2r_kind) *kind, unsigned flags);         \
00279                                                                            \
00280 FFTW_EXTERN X(plan) X(plan_r2r)(int rank, const int *n, R *in, R *out,     \
00281                     const X(r2r_kind) *kind, unsigned flags);              \
00282                                                                            \
00283 FFTW_EXTERN X(plan) X(plan_r2r_1d)(int n, R *in, R *out,                   \
00284                        X(r2r_kind) kind, unsigned flags);                  \
00285 FFTW_EXTERN X(plan) X(plan_r2r_2d)(int n0, int n1, R *in, R *out,          \
00286                        X(r2r_kind) kind0, X(r2r_kind) kind1,               \
00287                        unsigned flags);                                    \
00288 FFTW_EXTERN X(plan) X(plan_r2r_3d)(int n0, int n1, int n2,                 \
00289                        R *in, R *out, X(r2r_kind) kind0,                   \
00290                        X(r2r_kind) kind1, X(r2r_kind) kind2,               \
00291                        unsigned flags);                                    \
00292                                                                            \
00293 FFTW_EXTERN X(plan) X(plan_guru_r2r)(int rank, const X(iodim) *dims,       \
00294                          int howmany_rank,                                 \
00295                          const X(iodim) *howmany_dims,                     \
00296                          R *in, R *out,                                    \
00297                          const X(r2r_kind) *kind, unsigned flags);         \
00298                                                                            \
00299 FFTW_EXTERN X(plan) X(plan_guru64_r2r)(int rank, const X(iodim64) *dims,   \
00300                          int howmany_rank,                                 \
00301                          const X(iodim64) *howmany_dims,                   \
00302                          R *in, R *out,                                    \
00303                          const X(r2r_kind) *kind, unsigned flags);         \
00304                                                                            \
00305 FFTW_EXTERN void X(execute_r2r)(const X(plan) p, R *in, R *out);           \
00306                                                                            \
00307 FFTW_EXTERN void X(destroy_plan)(X(plan) p);                               \
00308 FFTW_EXTERN void X(forget_wisdom)(void);                                   \
00309 FFTW_EXTERN void X(cleanup)(void);                                         \
00310                                                                            \
00311 FFTW_EXTERN void X(set_timelimit)(double);                                 \
00312                                                                            \
00313 FFTW_EXTERN void X(plan_with_nthreads)(int nthreads);                      \
00314 FFTW_EXTERN int X(init_threads)(void);                                     \
00315 FFTW_EXTERN void X(cleanup_threads)(void);                                 \
00316                                                                            \
00317 FFTW_EXTERN void X(export_wisdom_to_file)(FILE *output_file);              \
00318 FFTW_EXTERN char *X(export_wisdom_to_string)(void);                        \
00319 FFTW_EXTERN void X(export_wisdom)(void (*write_char)(char c, void *),      \
00320                                   void *data);                             \
00321 FFTW_EXTERN int X(import_system_wisdom)(void);                             \
00322 FFTW_EXTERN int X(import_wisdom_from_file)(FILE *input_file);              \
00323 FFTW_EXTERN int X(import_wisdom_from_string)(const char *input_string);    \
00324 FFTW_EXTERN int X(import_wisdom)(int (*read_char)(void *), void *data);    \
00325                                                                            \
00326 FFTW_EXTERN void X(fprint_plan)(const X(plan) p, FILE *output_file);       \
00327 FFTW_EXTERN void X(print_plan)(const X(plan) p);                           \
00328                                                                            \
00329 FFTW_EXTERN void *X(malloc)(size_t n);                                     \
00330 FFTW_EXTERN void X(free)(void *p);                                         \
00331                                                                            \
00332 FFTW_EXTERN void X(flops)(const X(plan) p,                                 \
00333                           double *add, double *mul, double *fmas);         \
00334 FFTW_EXTERN double X(estimate_cost)(const X(plan) p);                      \
00335                                                                            \
00336 FFTW_EXTERN const char X(version)[];                                       \
00337 FFTW_EXTERN const char X(cc)[];                                            \
00338 FFTW_EXTERN const char X(codelet_optim)[];
00339 
00340 
00341 /* end of FFTW_DEFINE_API macro */
00342 
00343 FFTW_DEFINE_API(FFTW_MANGLE_DOUBLE, double, fftw_complex)
00344 FFTW_DEFINE_API(FFTW_MANGLE_FLOAT, float, fftwf_complex)
00345 FFTW_DEFINE_API(FFTW_MANGLE_LONG_DOUBLE, long double, fftwl_complex)
00346 
00347 #define FFTW_FORWARD (-1)
00348 #define FFTW_BACKWARD (+1)
00349 
00350 #define FFTW_NO_TIMELIMIT (-1.0)
00351 
00352 /* documented flags */
00353 #define FFTW_MEASURE (0U)
00354 #define FFTW_DESTROY_INPUT (1U << 0)
00355 #define FFTW_UNALIGNED (1U << 1)
00356 #define FFTW_CONSERVE_MEMORY (1U << 2)
00357 #define FFTW_EXHAUSTIVE (1U << 3) /* NO_EXHAUSTIVE is default */
00358 #define FFTW_PRESERVE_INPUT (1U << 4) /* cancels FFTW_DESTROY_INPUT */
00359 #define FFTW_PATIENT (1U << 5) /* IMPATIENT is default */
00360 #define FFTW_ESTIMATE (1U << 6)
00361 
00362 /* undocumented beyond-guru flags */
00363 #define FFTW_ESTIMATE_PATIENT (1U << 7)
00364 #define FFTW_BELIEVE_PCOST (1U << 8)
00365 #define FFTW_NO_DFT_R2HC (1U << 9)
00366 #define FFTW_NO_NONTHREADED (1U << 10)
00367 #define FFTW_NO_BUFFERING (1U << 11)
00368 #define FFTW_NO_INDIRECT_OP (1U << 12)
00369 #define FFTW_ALLOW_LARGE_GENERIC (1U << 13) /* NO_LARGE_GENERIC is default */
00370 #define FFTW_NO_RANK_SPLITS (1U << 14)
00371 #define FFTW_NO_VRANK_SPLITS (1U << 15)
00372 #define FFTW_NO_VRECURSE (1U << 16)
00373 #define FFTW_NO_SIMD (1U << 17)
00374 #define FFTW_NO_SLOW (1U << 18)
00375 #define FFTW_NO_FIXED_RADIX_LARGE_N (1U << 19)
00376 #define FFTW_ALLOW_PRUNING (1U << 20)
00377 #define FFTW_WISDOM_ONLY (1U << 21)
00378 
00379 #ifdef __cplusplus
00380 }  /* extern "C" */
00381 #endif /* __cplusplus */
00382 
00383 #endif /* FFTW3_H */