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