00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef FFTW3_H
00025 #define FFTW3_H
00026
00027 #include <stdio.h>
00028
00029 #ifdef __cplusplus
00030 extern "C"
00031 {
00032 #endif
00033
00034
00035
00036 #ifdef _Complex_I
00037 # define FFTW_DEFINE_COMPLEX(R, C) typedef R _Complex C
00038 #else
00039 # define FFTW_DEFINE_COMPLEX(R, C) typedef R C[2]
00040 #endif
00041
00042 #define FFTW_CONCAT(prefix, name) prefix ## name
00043 #define FFTW_MANGLE_DOUBLE(name) FFTW_CONCAT(fftw_, name)
00044 #define FFTW_MANGLE_FLOAT(name) FFTW_CONCAT(fftwf_, name)
00045 #define FFTW_MANGLE_LONG_DOUBLE(name) FFTW_CONCAT(fftwl_, name)
00046
00047
00048 enum fftw_r2r_kind_do_not_use_me {
00049 FFTW_R2HC=0, FFTW_HC2R=1, FFTW_DHT=2,
00050 FFTW_REDFT00=3, FFTW_REDFT01=4, FFTW_REDFT10=5, FFTW_REDFT11=6,
00051 FFTW_RODFT00=7, FFTW_RODFT01=8, FFTW_RODFT10=9, FFTW_RODFT11=10
00052 };
00053
00054 struct fftw_iodim_do_not_use_me {
00055 int n;
00056 int is;
00057 int os;
00058 };
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069 #define FFTW_DEFINE_API(X, R, C) \
00070 \
00071 FFTW_DEFINE_COMPLEX(R, C); \
00072 \
00073 typedef struct X(plan_s) *X(plan); \
00074 \
00075 typedef struct fftw_iodim_do_not_use_me X(iodim); \
00076 \
00077 typedef enum fftw_r2r_kind_do_not_use_me X(r2r_kind); \
00078 \
00079 void X(execute)(const X(plan) p); \
00080 \
00081 X(plan) X(plan_dft)(int rank, const int *n, \
00082 C *in, C *out, int sign, unsigned flags); \
00083 \
00084 X(plan) X(plan_dft_1d)(int n, C *in, C *out, int sign, \
00085 unsigned flags); \
00086 X(plan) X(plan_dft_2d)(int nx, int ny, \
00087 C *in, C *out, int sign, unsigned flags); \
00088 X(plan) X(plan_dft_3d)(int nx, int ny, int nz, \
00089 C *in, C *out, int sign, unsigned flags); \
00090 \
00091 X(plan) X(plan_many_dft)(int rank, const int *n, \
00092 int howmany, \
00093 C *in, const int *inembed, \
00094 int istride, int idist, \
00095 C *out, const int *onembed, \
00096 int ostride, int odist, \
00097 int sign, unsigned flags); \
00098 \
00099 X(plan) X(plan_guru_dft)(int rank, const X(iodim) *dims, \
00100 int howmany_rank, \
00101 const X(iodim) *howmany_dims, \
00102 C *in, C *out, \
00103 int sign, unsigned flags); \
00104 X(plan) X(plan_guru_split_dft)(int rank, const X(iodim) *dims, \
00105 int howmany_rank, \
00106 const X(iodim) *howmany_dims, \
00107 R *ri, R *ii, R *ro, R *io, \
00108 unsigned flags); \
00109 \
00110 void X(execute_dft)(const X(plan) p, C *in, C *out); \
00111 void X(execute_split_dft)(const X(plan) p, R *ri, R *ii, R *ro, R *io); \
00112 \
00113 X(plan) X(plan_many_dft_r2c)(int rank, const int *n, \
00114 int howmany, \
00115 R *in, const int *inembed, \
00116 int istride, int idist, \
00117 C *out, const int *onembed, \
00118 int ostride, int odist, \
00119 unsigned flags); \
00120 \
00121 X(plan) X(plan_dft_r2c)(int rank, const int *n, \
00122 R *in, C *out, unsigned flags); \
00123 \
00124 X(plan) X(plan_dft_r2c_1d)(int n,R *in,C *out,unsigned flags); \
00125 X(plan) X(plan_dft_r2c_2d)(int nx, int ny, \
00126 R *in, C *out, unsigned flags); \
00127 X(plan) X(plan_dft_r2c_3d)(int nx, int ny, \
00128 int nz, \
00129 R *in, C *out, unsigned flags); \
00130 \
00131 \
00132 X(plan) X(plan_many_dft_c2r)(int rank, const int *n, \
00133 int howmany, \
00134 C *in, const int *inembed, \
00135 int istride, int idist, \
00136 R *out, const int *onembed, \
00137 int ostride, int odist, \
00138 unsigned flags); \
00139 \
00140 X(plan) X(plan_dft_c2r)(int rank, const int *n, \
00141 C *in, R *out, unsigned flags); \
00142 \
00143 X(plan) X(plan_dft_c2r_1d)(int n,C *in,R *out,unsigned flags); \
00144 X(plan) X(plan_dft_c2r_2d)(int nx, int ny, \
00145 C *in, R *out, unsigned flags); \
00146 X(plan) X(plan_dft_c2r_3d)(int nx, int ny, \
00147 int nz, \
00148 C *in, R *out, unsigned flags); \
00149 \
00150 X(plan) X(plan_guru_dft_r2c)(int rank, const X(iodim) *dims, \
00151 int howmany_rank, \
00152 const X(iodim) *howmany_dims, \
00153 R *in, C *out, \
00154 unsigned flags); \
00155 X(plan) X(plan_guru_dft_c2r)(int rank, const X(iodim) *dims, \
00156 int howmany_rank, \
00157 const X(iodim) *howmany_dims, \
00158 C *in, R *out, \
00159 unsigned flags); \
00160 \
00161 X(plan) X(plan_guru_split_dft_r2c)(int rank, const X(iodim) *dims, \
00162 int howmany_rank, \
00163 const X(iodim) *howmany_dims, \
00164 R *in, R *ro, R *io, \
00165 unsigned flags); \
00166 X(plan) X(plan_guru_split_dft_c2r)(int rank, const X(iodim) *dims, \
00167 int howmany_rank, \
00168 const X(iodim) *howmany_dims, \
00169 R *ri, R *ii, R *out, \
00170 unsigned flags); \
00171 \
00172 void X(execute_dft_r2c)(const X(plan) p, R *in, C *out); \
00173 void X(execute_dft_c2r)(const X(plan) p, C *in, R *out); \
00174 \
00175 void X(execute_split_dft_r2c)(const X(plan) p, R *in, R *ro, R *io); \
00176 void X(execute_split_dft_c2r)(const X(plan) p, R *ri, R *ii, R *out); \
00177 \
00178 X(plan) X(plan_many_r2r)(int rank, const int *n, \
00179 int howmany, \
00180 R *in, const int *inembed, \
00181 int istride, int idist, \
00182 R *out, const int *onembed, \
00183 int ostride, int odist, \
00184 const X(r2r_kind) *kind, unsigned flags); \
00185 \
00186 X(plan) X(plan_r2r)(int rank, const int *n, R *in, R *out, \
00187 const X(r2r_kind) *kind, unsigned flags); \
00188 \
00189 X(plan) X(plan_r2r_1d)(int n, R *in, R *out, \
00190 X(r2r_kind) kind, unsigned flags); \
00191 X(plan) X(plan_r2r_2d)(int nx, int ny, R *in, R *out, \
00192 X(r2r_kind) kindx, X(r2r_kind) kindy, \
00193 unsigned flags); \
00194 X(plan) X(plan_r2r_3d)(int nx, int ny, int nz, \
00195 R *in, R *out, X(r2r_kind) kindx, \
00196 X(r2r_kind) kindy, X(r2r_kind) kindz, \
00197 unsigned flags); \
00198 \
00199 X(plan) X(plan_guru_r2r)(int rank, const X(iodim) *dims, \
00200 int howmany_rank, \
00201 const X(iodim) *howmany_dims, \
00202 R *in, R *out, \
00203 const X(r2r_kind) *kind, unsigned flags); \
00204 void X(execute_r2r)(const X(plan) p, R *in, R *out); \
00205 \
00206 void X(destroy_plan)(X(plan) p); \
00207 void X(forget_wisdom)(void); \
00208 void X(cleanup)(void); \
00209 \
00210 void X(plan_with_nthreads)(int nthreads); \
00211 int X(init_threads)(void); \
00212 void X(cleanup_threads)(void); \
00213 \
00214 void X(export_wisdom_to_file)(FILE *output_file); \
00215 char *X(export_wisdom_to_string)(void); \
00216 void X(export_wisdom)(void (*write_char)(char c, void *), void *data); \
00217 int X(import_system_wisdom)(void); \
00218 int X(import_wisdom_from_file)(FILE *input_file); \
00219 int X(import_wisdom_from_string)(const char *input_string); \
00220 int X(import_wisdom)(int (*read_char)(void *), void *data); \
00221 \
00222 void X(fprint_plan)(const X(plan) p, FILE *output_file); \
00223 void X(print_plan)(const X(plan) p); \
00224 \
00225 void *X(malloc)(size_t n); \
00226 void X(free)(void *p); \
00227 \
00228 void X(flops)(const X(plan) p, double *add, double *mul, double *fma); \
00229 \
00230 extern const char X(version)[]; \
00231 extern const char X(cc)[]; \
00232 extern const char X(codelet_optim)[];
00233
00234
00235
00236
00237 FFTW_DEFINE_API(FFTW_MANGLE_DOUBLE, double, fftw_complex)
00238 FFTW_DEFINE_API(FFTW_MANGLE_FLOAT, float, fftwf_complex)
00239 FFTW_DEFINE_API(FFTW_MANGLE_LONG_DOUBLE, long double, fftwl_complex)
00240
00241 #define FFTW_FORWARD (-1)
00242 #define FFTW_BACKWARD (+1)
00243
00244
00245 #define FFTW_MEASURE (0U)
00246 #define FFTW_DESTROY_INPUT (1U << 0)
00247 #define FFTW_UNALIGNED (1U << 1)
00248 #define FFTW_CONSERVE_MEMORY (1U << 2)
00249 #define FFTW_EXHAUSTIVE (1U << 3)
00250 #define FFTW_PRESERVE_INPUT (1U << 4)
00251 #define FFTW_PATIENT (1U << 5)
00252 #define FFTW_ESTIMATE (1U << 6)
00253
00254
00255 #define FFTW_ESTIMATE_PATIENT (1U << 7)
00256 #define FFTW_BELIEVE_PCOST (1U << 8)
00257 #define FFTW_DFT_R2HC_ICKY (1U << 9)
00258 #define FFTW_NONTHREADED_ICKY (1U << 10)
00259 #define FFTW_NO_BUFFERING (1U << 11)
00260 #define FFTW_NO_INDIRECT_OP (1U << 12)
00261 #define FFTW_ALLOW_LARGE_GENERIC (1U << 13)
00262 #define FFTW_NO_RANK_SPLITS (1U << 14)
00263 #define FFTW_NO_VRANK_SPLITS (1U << 15)
00264 #define FFTW_NO_VRECURSE (1U << 16)
00265
00266 #define FFTW_NO_SIMD (1U << 17)
00267
00268 #ifdef __cplusplus
00269 }
00270 #endif
00271
00272 #endif