![]() |
NFFT
3.3.2
|
00001 /* 00002 * Copyright (c) 2002, 2016 Jens Keiner, Stefan Kunis, Daniel Potts 00003 * 00004 * This program is free software; you can redistribute it and/or modify it under 00005 * the terms of the GNU General Public License as published by the Free Software 00006 * Foundation; either version 2 of the License, or (at your option) any later 00007 * version. 00008 * 00009 * This program is distributed in the hope that it will be useful, but WITHOUT 00010 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00011 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 00012 * details. 00013 * 00014 * You should have received a copy of the GNU General Public License along with 00015 * this program; if not, write to the Free Software Foundation, Inc., 51 00016 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00017 */ 00018 00022 #ifndef __INFFT_H__ 00023 #define __INFFT_H__ 00024 00025 #include "config.h" 00026 00027 #include <math.h> 00028 #include <float.h> 00029 #ifdef HAVE_COMPLEX_H 00030 #include <complex.h> 00031 #endif 00032 #include <stdio.h> 00033 #include <string.h> 00034 00035 #include <stdlib.h> /* size_t */ 00036 #include <stdarg.h> /* va_list */ 00037 #include <stddef.h> /* ptrdiff_t */ 00038 00039 #if HAVE_SYS_TYPES_H 00040 #include <sys/types.h> 00041 #endif 00042 00043 #if HAVE_STDINT_H 00044 #include <stdint.h> /* uintptr_t, maybe */ 00045 #endif 00046 00047 #if HAVE_INTTYPES_H 00048 #include <inttypes.h> /* uintptr_t, maybe */ 00049 #endif 00050 00051 #include <fftw3.h> 00052 00053 #include "ticks.h" 00054 00066 /* Determine precision and name-mangling scheme. */ 00067 #define CONCAT(prefix, name) prefix ## name 00068 #if defined(NFFT_SINGLE) 00069 typedef float R; 00070 typedef float _Complex C; 00071 #define Y(name) CONCAT(nfftf_,name) 00072 #define FFTW(name) CONCAT(fftwf_,name) 00073 #define NFFT(name) CONCAT(nfftf_,name) 00074 #define NFCT(name) CONCAT(nfctf_,name) 00075 #define NFST(name) CONCAT(nfstf_,name) 00076 #define NFSFT(name) CONCAT(nfsftf_,name) 00077 #define SOLVER(name) CONCAT(solverf_,name) 00078 #elif defined(NFFT_LDOUBLE) 00079 typedef long double R; 00080 typedef long double _Complex C; 00081 #define Y(name) CONCAT(nfftl_,name) 00082 #define FFTW(name) CONCAT(fftwl_,name) 00083 #define NFFT(name) CONCAT(nfftl_,name) 00084 #define NFCT(name) CONCAT(nfctl_,name) 00085 #define NFST(name) CONCAT(nfstl_,name) 00086 #define NFSFT(name) CONCAT(nfsftl_,name) 00087 #define SOLVER(name) CONCAT(solverl_,name) 00088 #else 00089 typedef double R; 00090 typedef double _Complex C; 00091 #define Y(name) CONCAT(nfft_,name) 00092 #define FFTW(name) CONCAT(fftw_,name) 00093 #define NFFT(name) CONCAT(nfft_,name) 00094 #define NFCT(name) CONCAT(nfct_,name) 00095 #define NFST(name) CONCAT(nfst_,name) 00096 #define NFSFT(name) CONCAT(nfsft_,name) 00097 #define SOLVER(name) CONCAT(solver_,name) 00098 #endif 00099 #define X(name) Y(name) 00100 00101 #define STRINGIZEx(x) #x 00102 #define STRINGIZE(x) STRINGIZEx(x) 00103 00104 #ifdef NFFT_LDOUBLE 00105 # define K(x) ((R) x##L) 00106 #else 00107 # define K(x) ((R) x) 00108 #endif 00109 #define DK(name, value) const R name = K(value) 00110 00111 #if defined __CYGWIN32__ && !defined __CYGWIN__ 00112 /* For backwards compatibility with Cygwin b19 and 00113 earlier, we define __CYGWIN__ here, so that 00114 we can rely on checking just for that macro. */ 00115 # define __CYGWIN__ __CYGWIN32__ 00116 #endif 00117 00118 /* Integral type large enough to contain a stride (what ``int'' should have been 00119 * in the first place) */ 00120 typedef ptrdiff_t INT; 00121 00122 #define KPI K(3.1415926535897932384626433832795028841971693993751) 00123 #define K2PI K(6.2831853071795864769252867665590057683943387987502) 00124 #define K4PI K(12.5663706143591729538505735331180115367886775975004) 00125 #define KE K(2.7182818284590452353602874713526624977572470937000) 00126 00127 #define IF(x,a,b) ((x)?(a):(b)) 00128 #define MIN(a,b) (((a)<(b))?(a):(b)) 00129 #define MAX(a,b) (((a)>(b))?(a):(b)) 00130 #define ABS(x) (((x)>K(0.0))?(x):(-(x))) 00131 #define SIGN(a) (((a)>=0)?1:-1) 00132 #define SIGN(a) (((a)>=0)?1:-1) 00133 #define SIGNF(a) IF((a)<K(0.0),K(-1.0),K(1.0)) 00134 00135 /* Size of array. */ 00136 #define SIZE(x) sizeof(x)/sizeof(x[0]) 00137 00139 #define CSWAP(x,y) {C* NFFT_SWAP_temp__; \ 00140 NFFT_SWAP_temp__=(x); (x)=(y); (y)=NFFT_SWAP_temp__;} 00141 00143 #define RSWAP(x,y) {R* NFFT_SWAP_temp__; NFFT_SWAP_temp__=(x); \ 00144 (x)=(y); (y)=NFFT_SWAP_temp__;} 00145 00146 /* macros for window functions */ 00147 00148 #if defined(DIRAC_DELTA) 00149 #define PHI_HUT(n,k,d) K(1.0) 00150 #define PHI(n,x,d) IF(FABS((x)) < K(10E-8),K(1.0),K(0.0)) 00151 #define WINDOW_HELP_INIT(d) 00152 #define WINDOW_HELP_FINALIZE 00153 #define WINDOW_HELP_ESTIMATE_m 0 00154 #elif defined(GAUSSIAN) 00155 #define PHI_HUT(n,k,d) ((R)EXP(-(POW(KPI*(k)/n,K(2.0))*ths->b[d]))) 00156 #define PHI(n,x,d) ((R)EXP(-POW((x)*((R)n),K(2.0)) / \ 00157 ths->b[d])/SQRT(KPI*ths->b[d])) 00158 #define WINDOW_HELP_INIT \ 00159 { \ 00160 int WINDOW_idx; \ 00161 ths->b = (R*) Y(malloc)(ths->d*sizeof(R)); \ 00162 for (WINDOW_idx = 0; WINDOW_idx < ths->d; WINDOW_idx++) \ 00163 ths->b[WINDOW_idx]=(K(2.0)*ths->sigma[WINDOW_idx]) / \ 00164 (K(2.0)*ths->sigma[WINDOW_idx] - K(1.0)) * (((R)ths->m) / KPI); \ 00165 } 00166 #define WINDOW_HELP_FINALIZE {Y(free)(ths->b);} 00167 #if defined(NFFT_LDOUBLE) 00168 #define WINDOW_HELP_ESTIMATE_m 17 00169 #elif defined(NFFT_SINGLE) 00170 #define WINDOW_HELP_ESTIMATE_m 5 00171 #else 00172 #define WINDOW_HELP_ESTIMATE_m 13 00173 #endif 00174 #elif defined(B_SPLINE) 00175 #define PHI_HUT(n,k,d) ((R)(((k) == 0) ? K(1.0) / n : \ 00176 POW(SIN((k) * KPI / n) / ((k) * KPI / n), \ 00177 K(2.0) * ths->m)/n)) 00178 #define PHI(n,x,d) (Y(bsplines)(2*ths->m,((x)*n) + \ 00179 (R)ths->m) / n) 00180 #define WINDOW_HELP_INIT 00181 #define WINDOW_HELP_FINALIZE 00182 #if defined(NFFT_LDOUBLE) 00183 #define WINDOW_HELP_ESTIMATE_m 11 00184 #elif defined(NFFT_SINGLE) 00185 #define WINDOW_HELP_ESTIMATE_m 11 00186 #else 00187 #define WINDOW_HELP_ESTIMATE_m 11 00188 #endif 00189 #elif defined(SINC_POWER) 00190 #define PHI_HUT(n,k,d) (Y(bsplines)(2 * ths->m, (K(2.0) * ths->m*(k)) / \ 00191 ((K(2.0) * ths->sigma[(d)] - 1) * n / \ 00192 ths->sigma[(d)]) + (R)ths->m)) 00193 #define PHI(n,x,d) ((R)(n / ths->sigma[(d)] * \ 00194 (K(2.0) * ths->sigma[(d)] - K(1.0))/ (K(2.0)*ths->m) * \ 00195 POW(Y(sinc)(KPI * n / ths->sigma[(d)] * (x) * \ 00196 (K(2.0) * ths->sigma[(d)] - K(1.0)) / (K(2.0)*ths->m)) , 2*ths->m) / \ 00197 n)) 00198 #define WINDOW_HELP_INIT 00199 #define WINDOW_HELP_FINALIZE 00200 #if defined(NFFT_LDOUBLE) 00201 #define WINDOW_HELP_ESTIMATE_m 13 00202 #elif defined(NFFT_SINGLE) 00203 #define WINDOW_HELP_ESTIMATE_m 11 00204 #else 00205 #define WINDOW_HELP_ESTIMATE_m 11 00206 #endif 00207 #else /* Kaiser-Bessel is the default. */ 00208 #define PHI_HUT(n,k,d) (Y(bessel_i0)((R)(ths->m) * SQRT(ths->b[d] * ths->b[d] - (K(2.0) * KPI * (R)(k) / (R)(n)) * (K(2.0) * KPI * (R)(k) / (R)(n))))) 00209 #define PHI(n,x,d) ( (((R)(ths->m) * (R)(ths->m) - (x) * (R)(n) * (x) * (R)(n)) > K(0.0)) \ 00210 ? SINH(ths->b[d] * SQRT((R)(ths->m) * (R)(ths->m) - (x) * (R)(n) * (x) * (R)(n))) \ 00211 / (KPI * SQRT((R)(ths->m) * (R)(ths->m) - (x) * (R)(n) * (x) * (R)(n))) \ 00212 : ((((R)(ths->m) * (R)(ths->m) - (x) * (R)(n) * (x) * (R)(n)) < K(0.0)) \ 00213 ? SIN(ths->b[d] * SQRT((x) * (R)(n) * (x) * (R)(n) - (R)(ths->m) * (R)(ths->m))) \ 00214 / (KPI * SQRT((x) * (R)(n) * (x) * (R)(n) - (R)(ths->m) * (R)(ths->m))) \ 00215 : ths->b[d] / KPI)) 00216 #define WINDOW_HELP_INIT \ 00217 { \ 00218 int WINDOW_idx; \ 00219 ths->b = (R*) Y(malloc)((size_t)(ths->d) * sizeof(R)); \ 00220 for (WINDOW_idx = 0; WINDOW_idx < ths->d; WINDOW_idx++) \ 00221 ths->b[WINDOW_idx] = (KPI * (K(2.0) - K(1.0) / ths->sigma[WINDOW_idx])); \ 00222 } 00223 #define WINDOW_HELP_FINALIZE {Y(free)(ths->b);} 00224 #if defined(NFFT_LDOUBLE) 00225 #define WINDOW_HELP_ESTIMATE_m 9 00226 #elif defined(NFFT_SINGLE) 00227 #define WINDOW_HELP_ESTIMATE_m 4 00228 #else 00229 #define WINDOW_HELP_ESTIMATE_m 8 00230 #endif 00231 #endif 00232 00233 /* window.c */ 00234 INT Y(m2K)(const INT m); 00235 00236 #if defined(NFFT_LDOUBLE) 00237 #if HAVE_DECL_COPYSIGNL == 0 00238 extern long double copysignl(long double, long double); 00239 #endif 00240 #if HAVE_DECL_NEXTAFTERL == 0 00241 extern long double nextafterl(long double, long double); 00242 #endif 00243 #if HAVE_DECL_NANL == 0 00244 extern long double nanl(const char *tag); 00245 #endif 00246 #if HAVE_DECL_CEILL == 0 00247 extern long double ceill(long double); 00248 #endif 00249 #if HAVE_DECL_FLOORL == 0 00250 extern long double floorl(long double); 00251 #endif 00252 #if HAVE_DECL_NEARBYINTL == 0 00253 extern long double nearbyintl(long double); 00254 #endif 00255 #if HAVE_DECL_RINTL == 0 00256 extern long double rintl(long double); 00257 #endif 00258 #if HAVE_DECL_ROUNDL == 0 00259 extern long double roundl(long double); 00260 #endif 00261 #if HAVE_DECL_LRINTL == 0 00262 extern long int lrintl(long double); 00263 #endif 00264 #if HAVE_DECL_LROUNDL == 0 00265 extern long int lroundl(long double); 00266 #endif 00267 #if HAVE_DECL_LLRINTL == 0 00268 extern long long int llrintl(long double); 00269 #endif 00270 #if HAVE_DECL_LLROUNDL == 0 00271 extern long long int llroundl(long double); 00272 #endif 00273 #if HAVE_DECL_TRUNCL == 0 00274 extern long double truncl(long double); 00275 #endif 00276 #if HAVE_DECL_FMODL == 0 00277 extern long double fmodl(long double, long double); 00278 #endif 00279 #if HAVE_DECL_REMAINDERL == 0 00280 extern long double remainderl(long double, long double); 00281 #endif 00282 #if HAVE_DECL_REMQUOL == 0 00283 extern long double remquol(long double x, long double y, int *); 00284 #endif 00285 #if HAVE_DECL_FDIML == 0 00286 extern long double fdiml(long double, long double); 00287 #endif 00288 #if HAVE_DECL_FMAXL == 0 00289 extern long double fmaxl(long double, long double); 00290 #endif 00291 #if HAVE_DECL_FMINL == 0 00292 extern long double fminl(long double, long double); 00293 #endif 00294 #if HAVE_DECL_FMAL == 0 00295 extern long double fmal(long double x, long double y, long double z); 00296 #endif 00297 #if HAVE_DECL_FABSL == 0 00298 extern long double fabsl(long double); 00299 #endif 00300 #if HAVE_DECL_SQRTL == 0 00301 extern long double sqrtl(long double); 00302 #endif 00303 #if HAVE_DECL_CBRTL == 0 00304 extern long double cbrtl(long double); 00305 #endif 00306 #if HAVE_DECL_HYPOTL == 0 00307 extern long double hypotl(long double, long double); 00308 #endif 00309 #if HAVE_DECL_EXPL == 0 00310 extern long double expl(long double); 00311 #endif 00312 #if HAVE_DECL_EXP2L == 0 00313 extern long double exp2l(long double); 00314 #endif 00315 #if HAVE_DECL_EXPM1L == 0 00316 extern long double expm1l(long double); 00317 #endif 00318 #if HAVE_DECL_LOGL == 0 00319 extern long double logl(long double); 00320 #endif 00321 #if HAVE_DECL_LOG2L == 0 00322 extern long double log2l(long double); 00323 #endif 00324 #if HAVE_DECL_LOG10L == 0 00325 extern long double log10l(long double); 00326 #endif 00327 #if HAVE_DECL_LOG1PL == 0 00328 extern long double log1pl(long double); 00329 #endif 00330 #if HAVE_DECL_LOGBL == 0 00331 extern long double logbl(long double); 00332 #endif 00333 #if HAVE_DECL_ILOGBL == 0 00334 extern int ilogbl(long double); 00335 #endif 00336 #if HAVE_DECL_MODFL == 0 00337 extern long double modfl(long double, long double *); 00338 #endif 00339 #if HAVE_DECL_FREXPL == 0 00340 extern long double frexpl(long double, int *); 00341 #endif 00342 #if HAVE_DECL_LDEXPL == 0 00343 extern long double ldexpl(long double, int); 00344 #endif 00345 #if HAVE_DECL_SCALBNL == 0 00346 extern long double scalbnl(long double, int); 00347 #endif 00348 #if HAVE_DECL_SCALBLNL == 0 00349 extern long double scalblnl(long double, long int); 00350 #endif 00351 #if HAVE_DECL_POWL == 0 00352 extern long double powl(long double, long double); 00353 #endif 00354 #if HAVE_DECL_COSL == 0 00355 extern long double cosl(long double); 00356 #endif 00357 #if HAVE_DECL_SINL == 0 00358 extern long double sinl(long double); 00359 #endif 00360 #if HAVE_DECL_TANL == 0 00361 extern long double tanl(long double); 00362 #endif 00363 #if HAVE_DECL_COSHL == 0 00364 extern long double coshl(long double); 00365 #endif 00366 #if HAVE_DECL_SINHL == 0 00367 extern long double sinhl(long double); 00368 #endif 00369 #if HAVE_DECL_TANHL == 0 00370 extern long double tanhl(long double); 00371 #endif 00372 #if HAVE_DECL_ACOSL == 0 00373 extern long double acosl(long double); 00374 #endif 00375 #if HAVE_DECL_ASINL == 0 00376 extern long double asinl(long double); 00377 #endif 00378 #if HAVE_DECL_ATANL == 0 00379 extern long double atanl(long double); 00380 #endif 00381 #if HAVE_DECL_ATAN2L == 0 00382 extern long double atan2l(long double, long double); 00383 #endif 00384 #if HAVE_DECL_ACOSHL == 0 00385 extern long double acoshl(long double); 00386 #endif 00387 #if HAVE_DECL_ASINHL == 0 00388 extern long double asinhl(long double); 00389 #endif 00390 #if HAVE_DECL_ATANHL == 0 00391 extern long double atanhl(long double); 00392 #endif 00393 #if HAVE_DECL_TGAMMAL == 0 00394 extern long double tgammal(long double); 00395 #endif 00396 #if HAVE_DECL_LGAMMAL == 0 00397 extern long double lgammal(long double); 00398 #endif 00399 #if HAVE_DECL_J0L == 0 00400 extern long double j0l(long double); 00401 #endif 00402 #if HAVE_DECL_J1L == 0 00403 extern long double j1l(long double); 00404 #endif 00405 #if HAVE_DECL_JNL == 0 00406 extern long double jnl(int, long double); 00407 #endif 00408 #if HAVE_DECL_Y0L == 0 00409 extern long double y0l(long double); 00410 #endif 00411 #if HAVE_DECL_Y1L == 0 00412 extern long double y1l(long double); 00413 #endif 00414 #if HAVE_DECL_YNL == 0 00415 extern long double ynl(int, long double); 00416 #endif 00417 #if HAVE_DECL_ERFL == 0 00418 extern long double erfl(long double); 00419 #endif 00420 #if HAVE_DECL_ERFCL == 0 00421 extern long double erfcl(long double); 00422 #endif 00423 #if HAVE_DECL_CREALL == 0 00424 extern long double creall(long double _Complex z); 00425 #endif 00426 #if HAVE_DECL_CIMAGL == 0 00427 extern long double cimagl(long double _Complex z); 00428 #endif 00429 #if HAVE_DECL_CABSL == 0 00430 extern long double cabsl(long double _Complex z); 00431 #endif 00432 #if HAVE_DECL_CARGL == 0 00433 extern long double cargl(long double _Complex z); 00434 #endif 00435 #if HAVE_DECL_CONJL == 0 00436 extern long double _Complex conjl(long double _Complex z); 00437 #endif 00438 #if HAVE_DECL_CPROJL == 0 00439 extern long double _Complex cprojl(long double _Complex z); 00440 #endif 00441 #if HAVE_DECL_CSQRTL == 0 00442 extern long double _Complex csqrtl(long double _Complex z); 00443 #endif 00444 #if HAVE_DECL_CEXPL == 0 00445 extern long double _Complex cexpl(long double _Complex z); 00446 #endif 00447 #if HAVE_DECL_CLOGL == 0 00448 extern long double _Complex clogl(long double _Complex z); 00449 #endif 00450 #if HAVE_DECL_CPOWL == 0 00451 extern long double _Complex cpowl(long double _Complex z, long double _Complex w); 00452 #endif 00453 #if HAVE_DECL_CSINL == 0 00454 extern long double _Complex csinl(long double _Complex z); 00455 #endif 00456 #if HAVE_DECL_CCOSL == 0 00457 extern long double _Complex ccosl(long double _Complex z); 00458 #endif 00459 #if HAVE_DECL_CTANL == 0 00460 extern long double _Complex ctanl(long double _Complex z); 00461 #endif 00462 #if HAVE_DECL_CASINL == 0 00463 extern long double _Complex casinl(long double _Complex z); 00464 #endif 00465 #if HAVE_DECL_CACOSL == 0 00466 extern long double _Complex cacosl(long double _Complex z); 00467 #endif 00468 #if HAVE_DECL_CATANL == 0 00469 extern long double _Complex catanl(long double _Complex z); 00470 #endif 00471 #if HAVE_DECL_CSINHL == 0 00472 extern long double _Complex csinhl(long double _Complex z); 00473 #endif 00474 #if HAVE_DECL_CCOSHL == 0 00475 extern long double _Complex ccoshl(long double _Complex z); 00476 #endif 00477 #if HAVE_DECL_CTANHL == 0 00478 extern long double _Complex ctanhl(long double _Complex z); 00479 #endif 00480 #if HAVE_DECL_CASINHL == 0 00481 extern long double _Complex casinhl(long double _Complex z); 00482 #endif 00483 #if HAVE_DECL_CACOSHL == 0 00484 extern long double _Complex cacoshl(long double _Complex z); 00485 #endif 00486 #if HAVE_DECL_CATANHL == 0 00487 extern long double _Complex catanhl(long double _Complex z); 00488 #endif 00489 #define COPYSIGN copysignl 00490 #define NEXTAFTER nextafterl 00491 #define MKNAN nanl 00492 #define CEIL ceill 00493 #define FLOOR floorl 00494 #define NEARBYINT nearbyintl 00495 #define RINT rintl 00496 #define ROUND roundl 00497 #define LRINT lrintl 00498 #define LROUND lroundl 00499 #define LLRINT llrintl 00500 #define LLROUND llroundl 00501 #define TRUNC truncl 00502 #define FMOD fmodl 00503 #define REMAINDER remainderl 00504 #define REMQUO remquol 00505 #define FDIM fdiml 00506 #define FMAX fmaxl 00507 #define FMIN fminl 00508 #define FFMA fmal 00509 #define FABS fabsl 00510 #define SQRT sqrtl 00511 #define CBRT cbrtl 00512 #define HYPOT hypotl 00513 #define EXP expl 00514 #define EXP2 exp2l 00515 #define EXPM1 expm1l 00516 #define LOG logl 00517 #define LOG2 log2l 00518 #define LOG10 log10l 00519 #define LOG1P log1pl 00520 #define LOGB logbl 00521 #define ILOGB ilogbl 00522 #define MODF modfl 00523 #define FREXP frexpl 00524 #define LDEXP ldexpl 00525 #define SCALBN scalbnl 00526 #define SCALBLN scalblnl 00527 #define POW powl 00528 #define COS cosl 00529 #define SIN sinl 00530 #define TAN tanl 00531 #define COSH coshl 00532 #define SINH sinhl 00533 #define TANH tanhl 00534 #define ACOS acosl 00535 #define ASIN asinl 00536 #define ATAN atanl 00537 #define ATAN2 atan2l 00538 #define ACOSH acoshl 00539 #define ASINH asinhl 00540 #define ATANH atanhl 00541 #define TGAMMA tgammal 00542 #define LGAMMA lgammal 00543 #define J0 j0l 00544 #define J1 j1l 00545 #define JN jnl 00546 #define Y0 y0l 00547 #define Y1 y1l 00548 #define YN ynl 00549 #define ERF erfl 00550 #define ERFC erfcl 00551 #define CREAL creall 00552 #define CIMAG cimagl 00553 #define CABS cabsl 00554 #define CARG cargl 00555 #define CONJ conjl 00556 #define CPROJ cprojl 00557 #define CSQRT csqrtl 00558 #define CEXP cexpl 00559 #define CLOG clogl 00560 #define CPOW cpowl 00561 #define CSIN csinl 00562 #define CCOS ccosl 00563 #define CTAN ctanl 00564 #define CASIN casinl 00565 #define CACOS cacosl 00566 #define CATAN catanl 00567 #define CSINH csinhl 00568 #define CCOSH ccoshl 00569 #define CTANH ctanhl 00570 #define CASINH casinhl 00571 #define CACOSH cacoshl 00572 #define CATANH catanhl 00573 #elif defined(NFFT_SINGLE) 00574 #if HAVE_DECL_COPYSIGNF == 0 00575 extern float copysignf(float, float); 00576 #endif 00577 #if HAVE_DECL_NEXTAFTERF == 0 00578 extern float nextafterf(float, float); 00579 #endif 00580 #if HAVE_DECL_NANF == 0 00581 extern float nanf(const char *tag); 00582 #endif 00583 #if HAVE_DECL_CEILF == 0 00584 extern float ceilf(float); 00585 #endif 00586 #if HAVE_DECL_FLOORF == 0 00587 extern float floorf(float); 00588 #endif 00589 #if HAVE_DECL_NEARBYINTF == 0 00590 extern float nearbyintf(float); 00591 #endif 00592 #if HAVE_DECL_RINTF == 0 00593 extern float rintf(float); 00594 #endif 00595 #if HAVE_DECL_ROUNDF == 0 00596 extern float roundf(float); 00597 #endif 00598 #if HAVE_DECL_LRINTF == 0 00599 extern long int lrintf(float); 00600 #endif 00601 #if HAVE_DECL_LROUNDF == 0 00602 extern long int lroundf(float); 00603 #endif 00604 #if HAVE_DECL_LLRINTF == 0 00605 extern long long int llrintf(float); 00606 #endif 00607 #if HAVE_DECL_LLROUNDF == 0 00608 extern long long int llroundf(float); 00609 #endif 00610 #if HAVE_DECL_TRUNCF == 0 00611 extern float truncf(float); 00612 #endif 00613 #if HAVE_DECL_FMODF == 0 00614 extern float fmodf(float, float); 00615 #endif 00616 #if HAVE_DECL_REMAINDERF == 0 00617 extern float remainderf(float, float); 00618 #endif 00619 #if HAVE_DECL_REMQUOF == 0 00620 extern float remquof(float x, float y, int *); 00621 #endif 00622 #if HAVE_DECL_FDIMF == 0 00623 extern float fdimf(float, float); 00624 #endif 00625 #if HAVE_DECL_FMAXF == 0 00626 extern float fmaxf(float, float); 00627 #endif 00628 #if HAVE_DECL_FMINF == 0 00629 extern float fminf(float, float); 00630 #endif 00631 #if HAVE_DECL_FMAF == 0 00632 extern float fmaf(float x, float y, float z); 00633 #endif 00634 #if HAVE_DECL_FABSF == 0 00635 extern float fabsf(float); 00636 #endif 00637 #if HAVE_DECL_SQRTF == 0 00638 extern float sqrtf(float); 00639 #endif 00640 #if HAVE_DECL_CBRTF == 0 00641 extern float cbrtf(float); 00642 #endif 00643 #if HAVE_DECL_HYPOTF == 0 00644 extern float hypotf(float, float); 00645 #endif 00646 #if HAVE_DECL_EXPF == 0 00647 extern float expf(float); 00648 #endif 00649 #if HAVE_DECL_EXP2F == 0 00650 extern float exp2f(float); 00651 #endif 00652 #if HAVE_DECL_EXPM1F == 0 00653 extern float expm1f(float); 00654 #endif 00655 #if HAVE_DECL_LOGF == 0 00656 extern float logf(float); 00657 #endif 00658 #if HAVE_DECL_LOG2F == 0 00659 extern float log2f(float); 00660 #endif 00661 #if HAVE_DECL_LOG10F == 0 00662 extern float log10f(float); 00663 #endif 00664 #if HAVE_DECL_LOG1PF == 0 00665 extern float log1pf(float); 00666 #endif 00667 #if HAVE_DECL_LOGBF == 0 00668 extern float logbf(float); 00669 #endif 00670 #if HAVE_DECL_ILOGBF == 0 00671 extern int ilogbf(float); 00672 #endif 00673 #if HAVE_DECL_MODFF == 0 00674 extern float modff(float, float *); 00675 #endif 00676 #if HAVE_DECL_FREXPF == 0 00677 extern float frexpf(float, int *); 00678 #endif 00679 #if HAVE_DECL_LDEXPF == 0 00680 extern float ldexpf(float, int); 00681 #endif 00682 #if HAVE_DECL_SCALBNF == 0 00683 extern float scalbnf(float, int); 00684 #endif 00685 #if HAVE_DECL_SCALBLNF == 0 00686 extern float scalblnf(float, long int); 00687 #endif 00688 #if HAVE_DECL_POWF == 0 00689 extern float powf(float, float); 00690 #endif 00691 #if HAVE_DECL_COSF == 0 00692 extern float cosf(float); 00693 #endif 00694 #if HAVE_DECL_SINF == 0 00695 extern float sinf(float); 00696 #endif 00697 #if HAVE_DECL_TANF == 0 00698 extern float tanf(float); 00699 #endif 00700 #if HAVE_DECL_COSHF == 0 00701 extern float coshf(float); 00702 #endif 00703 #if HAVE_DECL_SINHF == 0 00704 extern float sinhf(float); 00705 #endif 00706 #if HAVE_DECL_TANHF == 0 00707 extern float tanhf(float); 00708 #endif 00709 #if HAVE_DECL_ACOSF == 0 00710 extern float acosf(float); 00711 #endif 00712 #if HAVE_DECL_ASINF == 0 00713 extern float asinf(float); 00714 #endif 00715 #if HAVE_DECL_ATANF == 0 00716 extern float atanf(float); 00717 #endif 00718 #if HAVE_DECL_ATAN2F == 0 00719 extern float atan2f(float, float); 00720 #endif 00721 #if HAVE_DECL_ACOSHF == 0 00722 extern float acoshf(float); 00723 #endif 00724 #if HAVE_DECL_ASINHF == 0 00725 extern float asinhf(float); 00726 #endif 00727 #if HAVE_DECL_ATANHF == 0 00728 extern float atanhf(float); 00729 #endif 00730 #if HAVE_DECL_TGAMMAF == 0 00731 extern float tgammaf(float); 00732 #endif 00733 #if HAVE_DECL_LGAMMAF == 0 00734 extern float lgammaf(float); 00735 #endif 00736 #if HAVE_DECL_J0F == 0 00737 extern float j0f(float); 00738 #endif 00739 #if HAVE_DECL_J1F == 0 00740 extern float j1f(float); 00741 #endif 00742 #if HAVE_DECL_JNF == 0 00743 extern float jnf(int, float); 00744 #endif 00745 #if HAVE_DECL_Y0F == 0 00746 extern float y0f(float); 00747 #endif 00748 #if HAVE_DECL_Y1F == 0 00749 extern float y1f(float); 00750 #endif 00751 #if HAVE_DECL_YNF == 0 00752 extern float ynf(int, float); 00753 #endif 00754 #if HAVE_DECL_ERFF == 0 00755 extern float erff(float); 00756 #endif 00757 #if HAVE_DECL_ERFCF == 0 00758 extern float erfcf(float); 00759 #endif 00760 #if HAVE_DECL_CREALF == 0 00761 extern float crealf(float _Complex z); 00762 #endif 00763 #if HAVE_DECL_CIMAGF == 0 00764 extern float cimagf(float _Complex z); 00765 #endif 00766 #if HAVE_DECL_CABSF == 0 00767 extern float cabsf(float _Complex z); 00768 #endif 00769 #if HAVE_DECL_CARGF == 0 00770 extern float cargf(float _Complex z); 00771 #endif 00772 #if HAVE_DECL_CONJF == 0 00773 extern float _Complex conjf(float _Complex z); 00774 #endif 00775 #if HAVE_DECL_CPROJF == 0 00776 extern float _Complex cprojf(float _Complex z); 00777 #endif 00778 #if HAVE_DECL_CSQRTF == 0 00779 extern float _Complex csqrtf(float _Complex z); 00780 #endif 00781 #if HAVE_DECL_CEXPF == 0 00782 extern float _Complex cexpf(float _Complex z); 00783 #endif 00784 #if HAVE_DECL_CLOGF == 0 00785 extern float _Complex clogf(float _Complex z); 00786 #endif 00787 #if HAVE_DECL_CPOWF == 0 00788 extern float _Complex cpowf(float _Complex z, float _Complex w); 00789 #endif 00790 #if HAVE_DECL_CSINF == 0 00791 extern float _Complex csinf(float _Complex z); 00792 #endif 00793 #if HAVE_DECL_CCOSF == 0 00794 extern float _Complex ccosf(float _Complex z); 00795 #endif 00796 #if HAVE_DECL_CTANF == 0 00797 extern float _Complex ctanf(float _Complex z); 00798 #endif 00799 #if HAVE_DECL_CASINF == 0 00800 extern float _Complex casinf(float _Complex z); 00801 #endif 00802 #if HAVE_DECL_CACOSF == 0 00803 extern float _Complex cacosf(float _Complex z); 00804 #endif 00805 #if HAVE_DECL_CATANF == 0 00806 extern float _Complex catanf(float _Complex z); 00807 #endif 00808 #if HAVE_DECL_CSINHF == 0 00809 extern float _Complex csinhf(float _Complex z); 00810 #endif 00811 #if HAVE_DECL_CCOSHF == 0 00812 extern float _Complex ccoshf(float _Complex z); 00813 #endif 00814 #if HAVE_DECL_CTANHF == 0 00815 extern float _Complex ctanhf(float _Complex z); 00816 #endif 00817 #if HAVE_DECL_CASINHF == 0 00818 extern float _Complex casinhf(float _Complex z); 00819 #endif 00820 #if HAVE_DECL_CACOSHF == 0 00821 extern float _Complex cacoshf(float _Complex z); 00822 #endif 00823 #if HAVE_DECL_CATANHF == 0 00824 extern float _Complex catanhf(float _Complex z); 00825 #endif 00826 #define COPYSIGN copysignf 00827 #define NEXTAFTER nextafterf 00828 #define MKNAN nanf 00829 #define CEIL ceilf 00830 #define FLOOR floorf 00831 #define NEARBYINT nearbyintf 00832 #define RINT rintf 00833 #define ROUND roundf 00834 #define LRINT lrintf 00835 #define LROUND lroundf 00836 #define LLRINT llrintf 00837 #define LLROUND llroundf 00838 #define TRUNC truncf 00839 #define FMOD fmodf 00840 #define REMAINDER remainderf 00841 #define REMQUO remquof 00842 #define FDIM fdimf 00843 #define FMAX fmaxf 00844 #define FMIN fminf 00845 #define FFMA fmaf 00846 #define FABS fabsf 00847 #define SQRT sqrtf 00848 #define CBRT cbrtf 00849 #define HYPOT hypotf 00850 #define EXP expf 00851 #define EXP2 exp2f 00852 #define EXPM1 expm1f 00853 #define LOG logf 00854 #define LOG2 log2f 00855 #define LOG10 log10f 00856 #define LOG1P log1pf 00857 #define LOGB logbf 00858 #define ILOGB ilogbf 00859 #define MODF modff 00860 #define FREXP frexpf 00861 #define LDEXP ldexpf 00862 #define SCALBN scalbnf 00863 #define SCALBLN scalblnf 00864 #define POW powf 00865 #define COS cosf 00866 #define SIN sinf 00867 #define TAN tanf 00868 #define COSH coshf 00869 #define SINH sinhf 00870 #define TANH tanhf 00871 #define ACOS acosf 00872 #define ASIN asinf 00873 #define ATAN atanf 00874 #define ATAN2 atan2f 00875 #define ACOSH acoshf 00876 #define ASINH asinhf 00877 #define ATANH atanhf 00878 #define TGAMMA tgammaf 00879 #define LGAMMA lgammaf 00880 #define J0 j0f 00881 #define J1 j1f 00882 #define JN jnf 00883 #define Y0 y0f 00884 #define Y1 y1f 00885 #define YN ynf 00886 #define ERF erff 00887 #define ERFC erfcf 00888 #define CREAL crealf 00889 #define CIMAG cimagf 00890 #define CABS cabsf 00891 #define CARG cargf 00892 #define CONJ conjf 00893 #define CPROJ cprojf 00894 #define CSQRT csqrtf 00895 #define CEXP cexpf 00896 #define CLOG clogf 00897 #define CPOW cpowf 00898 #define CSIN csinf 00899 #define CCOS ccosf 00900 #define CTAN ctanf 00901 #define CASIN casinf 00902 #define CACOS cacosf 00903 #define CATAN catanf 00904 #define CSINH csinhf 00905 #define CCOSH ccoshf 00906 #define CTANH ctanhf 00907 #define CASINH casinhf 00908 #define CACOSH cacoshf 00909 #define CATANH catanhf 00910 #else 00911 #if HAVE_DECL_COPYSIGN == 0 00912 extern double copysign(double, double); 00913 #endif 00914 #if HAVE_DECL_NEXTAFTER == 0 00915 extern double nextafter(double, double); 00916 #endif 00917 #if HAVE_DECL_NAN == 0 00918 extern double nan(const char *tag); 00919 #endif 00920 #if HAVE_DECL_CEIL == 0 00921 extern double ceil(double); 00922 #endif 00923 #if HAVE_DECL_FLOOR == 0 00924 extern double floor(double); 00925 #endif 00926 #if HAVE_DECL_NEARBYINT == 0 00927 extern double nearbyint(double); 00928 #endif 00929 #if HAVE_DECL_RINT == 0 00930 extern double rint(double); 00931 #endif 00932 #if HAVE_DECL_ROUND == 0 00933 extern double round(double); 00934 #endif 00935 #if HAVE_DECL_LRINT == 0 00936 extern long int lrint(double); 00937 #endif 00938 #if HAVE_DECL_LROUND == 0 00939 extern long int lround(double); 00940 #endif 00941 #if HAVE_DECL_LLRINT == 0 00942 extern long long int llrint(double); 00943 #endif 00944 #if HAVE_DECL_LLROUND == 0 00945 extern long long int llround(double); 00946 #endif 00947 #if HAVE_DECL_TRUNC == 0 00948 extern double trunc(double); 00949 #endif 00950 #if HAVE_DECL_FMOD == 0 00951 extern double fmod(double, double); 00952 #endif 00953 #if HAVE_DECL_REMAINDER == 0 00954 extern double remainder(double, double); 00955 #endif 00956 #if HAVE_DECL_REMQUO == 0 00957 extern double remquo(double x, double y, int *); 00958 #endif 00959 #if HAVE_DECL_FDIM == 0 00960 extern double fdim(double, double); 00961 #endif 00962 #if HAVE_DECL_FMAX == 0 00963 extern double fmax(double, double); 00964 #endif 00965 #if HAVE_DECL_FMIN == 0 00966 extern double fmin(double, double); 00967 #endif 00968 #if HAVE_DECL_FMA == 0 00969 extern double fma(double x, double y, double z); 00970 #endif 00971 #if HAVE_DECL_FABS == 0 00972 extern double fabs(double); 00973 #endif 00974 #if HAVE_DECL_SQRT == 0 00975 extern double sqrt(double); 00976 #endif 00977 #if HAVE_DECL_CBRT == 0 00978 extern double cbrt(double); 00979 #endif 00980 #if HAVE_DECL_HYPOT == 0 00981 extern double hypot(double, double); 00982 #endif 00983 #if HAVE_DECL_EXP == 0 00984 extern double exp(double); 00985 #endif 00986 #if HAVE_DECL_EXP2 == 0 00987 extern double exp2(double); 00988 #endif 00989 #if HAVE_DECL_EXPM1 == 0 00990 extern double expm1(double); 00991 #endif 00992 #if HAVE_DECL_LOG == 0 00993 extern double log(double); 00994 #endif 00995 #if HAVE_DECL_LOG2 == 0 00996 extern double log2(double); 00997 #endif 00998 #if HAVE_DECL_LOG10 == 0 00999 extern double log10(double); 01000 #endif 01001 #if HAVE_DECL_LOG1P == 0 01002 extern double log1p(double); 01003 #endif 01004 #if HAVE_DECL_LOGB == 0 01005 extern double logb(double); 01006 #endif 01007 #if HAVE_DECL_ILOGB == 0 01008 extern int ilogb(double); 01009 #endif 01010 #if HAVE_DECL_MODF == 0 01011 extern double modf(double, double *); 01012 #endif 01013 #if HAVE_DECL_FREXP == 0 01014 extern double frexp(double, int *); 01015 #endif 01016 #if HAVE_DECL_LDEXP == 0 01017 extern double ldexp(double, int); 01018 #endif 01019 #if HAVE_DECL_SCALBN == 0 01020 extern double scalbn(double, int); 01021 #endif 01022 #if HAVE_DECL_SCALBLN == 0 01023 extern double scalbln(double, long int); 01024 #endif 01025 #if HAVE_DECL_POW == 0 01026 extern double pow(double, double); 01027 #endif 01028 #if HAVE_DECL_COS == 0 01029 extern double cos(double); 01030 #endif 01031 #if HAVE_DECL_SIN == 0 01032 extern double sin(double); 01033 #endif 01034 #if HAVE_DECL_TAN == 0 01035 extern double tan(double); 01036 #endif 01037 #if HAVE_DECL_COSH == 0 01038 extern double cosh(double); 01039 #endif 01040 #if HAVE_DECL_SINH == 0 01041 extern double sinh(double); 01042 #endif 01043 #if HAVE_DECL_TANH == 0 01044 extern double tanh(double); 01045 #endif 01046 #if HAVE_DECL_ACOS == 0 01047 extern double acos(double); 01048 #endif 01049 #if HAVE_DECL_ASIN == 0 01050 extern double asin(double); 01051 #endif 01052 #if HAVE_DECL_ATAN == 0 01053 extern double atan(double); 01054 #endif 01055 #if HAVE_DECL_ATAN2 == 0 01056 extern double atan2(double, double); 01057 #endif 01058 #if HAVE_DECL_ACOSH == 0 01059 extern double acosh(double); 01060 #endif 01061 #if HAVE_DECL_ASINH == 0 01062 extern double asinh(double); 01063 #endif 01064 #if HAVE_DECL_ATANH == 0 01065 extern double atanh(double); 01066 #endif 01067 #if HAVE_DECL_TGAMMA == 0 01068 extern double tgamma(double); 01069 #endif 01070 #if HAVE_DECL_LGAMMA == 0 01071 extern double lgamma(double); 01072 #endif 01073 #if HAVE_DECL_J0 == 0 01074 extern double j0(double); 01075 #endif 01076 #if HAVE_DECL_J1 == 0 01077 extern double j1(double); 01078 #endif 01079 #if HAVE_DECL_JN == 0 01080 extern double jn(int, double); 01081 #endif 01082 #if HAVE_DECL_Y0 == 0 01083 extern double y0(double); 01084 #endif 01085 #if HAVE_DECL_Y1 == 0 01086 extern double y1(double); 01087 #endif 01088 #if HAVE_DECL_YN == 0 01089 extern double yn(int, double); 01090 #endif 01091 #if HAVE_DECL_ERF == 0 01092 extern double erf(double); 01093 #endif 01094 #if HAVE_DECL_ERFC == 0 01095 extern double erfc(double); 01096 #endif 01097 #if HAVE_DECL_CREAL == 0 01098 extern double creal(double _Complex z); 01099 #endif 01100 #if HAVE_DECL_CIMAG == 0 01101 extern double cimag(double _Complex z); 01102 #endif 01103 #if HAVE_DECL_CABS == 0 01104 extern double cabs(double _Complex z); 01105 #endif 01106 #if HAVE_DECL_CARG == 0 01107 extern double carg(double _Complex z); 01108 #endif 01109 #if HAVE_DECL_CONJ == 0 01110 extern double _Complex conj(double _Complex z); 01111 #endif 01112 #if HAVE_DECL_CPROJ == 0 01113 extern double _Complex cproj(double _Complex z); 01114 #endif 01115 #if HAVE_DECL_CSQRT == 0 01116 extern double _Complex csqrt(double _Complex z); 01117 #endif 01118 #if HAVE_DECL_CEXP == 0 01119 extern double _Complex cexp(double _Complex z); 01120 #endif 01121 #if HAVE_DECL_CLOG == 0 01122 extern double _Complex clog(double _Complex z); 01123 #endif 01124 #if HAVE_DECL_CPOW == 0 01125 extern double _Complex cpow(double _Complex z, double _Complex w); 01126 #endif 01127 #if HAVE_DECL_CSIN == 0 01128 extern double _Complex csin(double _Complex z); 01129 #endif 01130 #if HAVE_DECL_CCOS == 0 01131 extern double _Complex ccos(double _Complex z); 01132 #endif 01133 #if HAVE_DECL_CTAN == 0 01134 extern double _Complex ctan(double _Complex z); 01135 #endif 01136 #if HAVE_DECL_CASIN == 0 01137 extern double _Complex casin(double _Complex z); 01138 #endif 01139 #if HAVE_DECL_CACOS == 0 01140 extern double _Complex cacos(double _Complex z); 01141 #endif 01142 #if HAVE_DECL_CATAN == 0 01143 extern double _Complex catan(double _Complex z); 01144 #endif 01145 #if HAVE_DECL_CSINH == 0 01146 extern double _Complex csinh(double _Complex z); 01147 #endif 01148 #if HAVE_DECL_CCOSH == 0 01149 extern double _Complex ccosh(double _Complex z); 01150 #endif 01151 #if HAVE_DECL_CTANH == 0 01152 extern double _Complex ctanh(double _Complex z); 01153 #endif 01154 #if HAVE_DECL_CASINH == 0 01155 extern double _Complex casinh(double _Complex z); 01156 #endif 01157 #if HAVE_DECL_CACOSH == 0 01158 extern double _Complex cacosh(double _Complex z); 01159 #endif 01160 #if HAVE_DECL_CATANH == 0 01161 extern double _Complex catanh(double _Complex z); 01162 #endif 01163 #define COPYSIGN copysign 01164 #define NEXTAFTER nextafter 01165 #define MKNAN nan 01166 #define CEIL ceil 01167 #define FLOOR floor 01168 #define NEARBYINT nearbyint 01169 #define RINT rint 01170 #define ROUND round 01171 #define LRINT lrint 01172 #define LROUND lround 01173 #define LLRINT llrint 01174 #define LLROUND llround 01175 #define TRUNC trunc 01176 #define FMOD fmod 01177 #define REMAINDER remainder 01178 #define REMQUO remquo 01179 #define FDIM fdim 01180 #define FMAX fmax 01181 #define FMIN fmin 01182 #define FFMA fma 01183 #define FABS fabs 01184 #define SQRT sqrt 01185 #define CBRT cbrt 01186 #define HYPOT hypot 01187 #define EXP exp 01188 #define EXP2 exp2 01189 #define EXPM1 expm1 01190 #define LOG log 01191 #define LOG2 log2 01192 #define LOG10 log10 01193 #define LOG1P log1p 01194 #define LOGB logb 01195 #define ILOGB ilogb 01196 #define MODF modf 01197 #define FREXP frexp 01198 #define LDEXP ldexp 01199 #define SCALBN scalbn 01200 #define SCALBLN scalbln 01201 #define POW pow 01202 #define COS cos 01203 #define SIN sin 01204 #define TAN tan 01205 #define COSH cosh 01206 #define SINH sinh 01207 #define TANH tanh 01208 #define ACOS acos 01209 #define ASIN asin 01210 #define ATAN atan 01211 #define ATAN2 atan2 01212 #define ACOSH acosh 01213 #define ASINH asinh 01214 #define ATANH atanh 01215 #define TGAMMA tgamma 01216 #define LGAMMA lgamma 01217 #define J0 j0 01218 #define J1 j1 01219 #define JN jn 01220 #define Y0 y0 01221 #define Y1 y1 01222 #define YN yn 01223 #define ERF erf 01224 #define ERFC erfc 01225 #define CREAL creal 01226 #define CIMAG cimag 01227 #define CABS cabs 01228 #define CARG carg 01229 #define CONJ conj 01230 #define CPROJ cproj 01231 #define CSQRT csqrt 01232 #define CEXP cexp 01233 #define CLOG clog 01234 #define CPOW cpow 01235 #define CSIN csin 01236 #define CCOS ccos 01237 #define CTAN ctan 01238 #define CASIN casin 01239 #define CACOS cacos 01240 #define CATAN catan 01241 #define CSINH csinh 01242 #define CCOSH ccosh 01243 #define CTANH ctanh 01244 #define CASINH casinh 01245 #define CACOSH cacosh 01246 #define CATANH catanh 01247 #endif 01248 01249 #if defined(NFFT_LDOUBLE) 01250 #define EPSILON LDBL_EPSILON//4.0E-31L 01251 #define MANT_DIG LDBL_MANT_DIG 01252 #define MIN_EXP LDBL_MIN_EXP 01253 #define MAX_EXP LDBL_MAX_EXP 01254 #elif defined(NFFT_SINGLE) 01255 #define EPSILON FLT_EPSILON 01256 #define MANT_DIG FLT_MANT_DIG 01257 #define MIN_EXP FLT_MIN_EXP 01258 #define MAX_EXP FLT_MAX_EXP 01259 #else 01260 #define EPSILON DBL_EPSILON 01261 #define MANT_DIG DBL_MANT_DIG 01262 #define MIN_EXP DBL_MIN_EXP 01263 #define MAX_EXP DBL_MAX_EXP 01264 #endif 01265 01266 #if defined(FLT_ROUND) 01267 #if FLT_ROUND != -1 01268 #define FLTROUND 1.0 01269 #else 01270 #define FLTROUND 0.0 01271 #endif 01272 #else 01273 #define FLTROUND 0.0 01274 #endif 01275 01276 #if HAVE_DECL_DRAND48 == 0 01277 extern double drand48(void); 01278 #endif 01279 #if HAVE_DECL_SRAND48 == 0 01280 extern void srand48(long int); 01281 #endif 01282 #define R_RADIX FLT_RADIX 01283 #define II _Complex_I 01284 01285 /* format strings */ 01286 #if defined(NFFT_LDOUBLE) 01287 # define __FGS__ "Lg" 01288 # define __FES__ "LE" 01289 # define __FE__ "% 36.32LE" 01290 # define __FI__ "%Lf" 01291 # define __FIS__ "Lf" 01292 # define __FR__ "%Le" 01293 #elif defined(NFFT_SINGLE) 01294 # define __FGS__ "g" 01295 # define __FES__ "E" 01296 # define __FE__ "% 12.8E" 01297 # define __FI__ "%f" 01298 # define __FIS__ "f" 01299 # define __FR__ "%e" 01300 #else 01301 # define __FGS__ "lg" 01302 # define __FES__ "lE" 01303 # define __FE__ "% 20.16lE" 01304 # define __FI__ "%lf" 01305 # define __FIS__ "lf" 01306 # define __FR__ "%le" 01307 #endif 01308 01309 #define TRUE 1 01310 #define FALSE 0 01311 01312 #if defined(_WIN32) || defined(_WIN64) 01313 # define __D__ "%Id" 01314 #else 01315 # define __D__ "%td" 01316 #endif 01317 01319 #define UNUSED(x) (void)x 01320 01321 #ifdef HAVE_ALLOCA 01322 /* Use alloca if available. */ 01323 #ifndef alloca 01324 #ifdef __GNUC__ 01325 /* No alloca defined but can use GCC's builtin version. */ 01326 #define alloca __builtin_alloca 01327 #else 01328 /* No alloca defined and not using GCC. */ 01329 #ifdef _MSC_VER 01330 /* Using Microsoft's C compiler. Include header file and use _alloca 01331 * defined therein. */ 01332 #include <malloc.h> 01333 #define alloca _alloca 01334 #else 01335 /* Also not using Microsoft's C compiler. */ 01336 #if HAVE_ALLOCA_H 01337 /* Alloca header is available. */ 01338 #include <alloca.h> 01339 #else 01340 /* No alloca header available. */ 01341 #ifdef _AIX 01342 /* We're using the AIX C compiler. Use pragma. */ 01343 #pragma alloca 01344 #else 01345 /* Not using AIX compiler. */ 01346 #ifndef alloca /* HP's cc +Olibcalls predefines alloca. */ 01347 void *alloca(size_t); 01348 #endif 01349 #endif 01350 #endif 01351 #endif 01352 #endif 01353 #endif 01354 /* So we have alloca. */ 01355 #define STACK_MALLOC(T, p, x) p = (T)alloca(x) 01356 #define STACK_FREE(x) /* Nothing. Cleanup done automatically. */ 01357 #else /* ! HAVE_ALLOCA */ 01358 /* Use malloc instead of alloca. So we allocate memory on the heap instead of 01359 * on the stack which is slower. */ 01360 #define STACK_MALLOC(T, p, x) p = (T)Y(malloc)(x) 01361 #define STACK_FREE(x) Y(free)(x) 01362 #endif /* ! HAVE_ALLOCA */ 01363 01365 R Y(elapsed_seconds)(ticks t1, ticks t0); 01366 01368 #define UNUSED(x) (void)x 01369 01376 #ifdef MEASURE_TIME 01377 int MEASURE_TIME_r; 01378 double MEASURE_TIME_tt; 01379 ticks MEASURE_TIME_t0, MEASURE_TIME_t1; 01380 01381 #define TIC(a) \ 01382 ths->MEASURE_TIME_t[(a)]=0; \ 01383 MEASURE_TIME_r=0; \ 01384 /* DISABLED LOOP due to code blocks causing segfault when repeatedly run */ \ 01385 /*while(ths->MEASURE_TIME_t[(a)]<0.01)*/ \ 01386 { \ 01387 MEASURE_TIME_r++; \ 01388 MEASURE_TIME_t0 = getticks(); \ 01389 01390 /* THE MEASURED FUNCTION IS CALLED REPEATEDLY */ 01391 01392 #define TOC(a) \ 01393 MEASURE_TIME_t1 = getticks(); \ 01394 MEASURE_TIME_tt = Y(elapsed_seconds)(MEASURE_TIME_t1,MEASURE_TIME_t0);\ 01395 ths->MEASURE_TIME_t[(a)]+=MEASURE_TIME_tt; \ 01396 } \ 01397 ths->MEASURE_TIME_t[(a)]/=MEASURE_TIME_r; \ 01398 01399 #else 01400 #define TIC(a) 01401 #define TOC(a) 01402 #endif 01403 01404 #ifdef MEASURE_TIME_FFTW 01405 #define TIC_FFTW(a) TIC(a) 01406 #define TOC_FFTW(a) TOC(a) 01407 #else 01408 #define TIC_FFTW(a) 01409 #define TOC_FFTW(a) 01410 #endif 01411 01412 /* sinc.c: */ 01413 01414 /* Sinus cardinalis. */ 01415 R Y(sinc)(R x); 01416 01417 /* lambda.c: */ 01418 01419 /* lambda(z, eps) = gamma(z + eps) / gamma(z + 1) */ 01420 R Y(lambda)(R z, R eps); 01421 01422 /* lambda2(mu, nu) = sqrt(gamma(mu + nu + 1) / (gamma(mu + 1) * gamma(nu + 1))) */ 01423 R Y(lambda2)(R mu, R nu); 01424 01425 /* bessel_i0.c: */ 01426 R Y(bessel_i0)(R x); 01427 01428 /* bspline.c: */ 01429 R Y(bsplines)(const INT, const R x); 01430 01431 /* float.c: */ 01432 typedef enum {NFFT_EPSILON = 0, NFFT_SAFE__MIN = 1, NFFT_BASE = 2, 01433 NFFT_PRECISION = 3, NFFT_MANT_DIG = 4, NFFT_FLTROUND = 5, NFFT_E_MIN = 6, 01434 NFFT_R_MIN = 7, NFFT_E_MAX = 8, NFFT_R_MAX = 9} float_property; 01435 01436 R Y(float_property)(float_property); 01437 R Y(prod_real)(R *vec, INT d); 01438 01439 /* int.c: */ 01440 INT Y(log2i)(const INT m); 01441 void Y(next_power_of_2_exp)(const INT N, INT *N2, INT *t); 01442 void Y(next_power_of_2_exp_int)(const int N, int *N2, int *t); 01443 01444 /* error.c: */ 01445 /* not used */ R Y(error_l_infty_double)(const R *x, const R *y, const INT n); 01446 /* not used */ R Y(error_l_infty_1_double)(const R *x, const R *y, const INT n, const R *z, 01447 const INT m); 01448 R Y(error_l_2_complex)(const C *x, const C *y, const INT n); 01449 /* not used */ R Y(error_l_2_double)(const R *x, const R *y, const INT n); 01450 01451 /* sort.c: */ 01452 void Y(sort_node_indices_radix_msdf)(INT n, INT *keys0, INT *keys1, INT rhigh); 01453 void Y(sort_node_indices_radix_lsdf)(INT n, INT *keys0, INT *keys1, INT rhigh); 01454 01455 /* assert.c */ 01456 void Y(assertion_failed)(const char *s, int line, const char *file); 01457 01458 /* vector1.c */ 01460 R Y(dot_double)(R *x, INT n); 01462 R Y(dot_w_complex)(C *x, R *w, INT n); 01464 R Y(dot_w_double)(R *x, R *w, INT n); 01466 R Y(dot_w_w2_complex)(C *x, R *w, R *w2, INT n); 01468 R Y(dot_w2_complex)(C *x, R *w2, INT n); 01469 01470 /* vector2.c */ 01472 void Y(cp_complex)(C *x, C *y, INT n); 01474 void Y(cp_double)(R *x, R *y, INT n); 01476 void Y(cp_a_complex)(C *x, R a, C *y, INT n); 01478 void Y(cp_a_double)(R *x, R a, R *y, INT n); 01480 void Y(cp_w_complex)(C *x, R *w, C *y, INT n); 01482 void Y(cp_w_double)(R *x, R *w, R *y, INT n); 01483 01484 /* vector3.c */ 01486 void Y(upd_axpy_double)(R *x, R a, R *y, INT n); 01488 void Y(upd_xpay_complex)(C *x, R a, C *y, INT n); 01490 void Y(upd_xpay_double)(R *x, R a, R *y, INT n); 01492 void Y(upd_axpby_complex)(C *x, R a, C *y, R b, INT n); 01494 void Y(upd_axpby_double)(R *x, R a, R *y, R b, INT n); 01496 void Y(upd_xpawy_complex)(C *x, R a, R *w, C *y, INT n); 01498 void Y(upd_xpawy_double)(R *x, R a, R *w, R *y, INT n); 01500 void Y(upd_axpwy_complex)(C *x, R a, R *w, C *y, INT n); 01502 void Y(upd_axpwy_double)(R *x, R a, R *w, R *y, INT n); 01503 01504 /* voronoi.c */ 01505 void Y(voronoi_weights_1d)(R *w, R *x, const INT M); 01506 01507 /* damp.c */ 01512 R Y(modified_fejer)(const INT N, const INT kk); 01514 R Y(modified_jackson2)(const INT N, const INT kk); 01516 R Y(modified_jackson4)(const INT N, const INT kk); 01518 R Y(modified_sobolev)(const R mu, const INT kk); 01520 R Y(modified_multiquadric)(const R mu, const R c, const INT kk); 01521 01522 /* always check */ 01523 #define CK(ex) \ 01524 (void)((ex) || (Y(assertion_failed)(#ex, __LINE__, __FILE__), 0)) 01525 01526 #ifdef NFFT_DEBUG 01527 /* check only if debug enabled */ 01528 #define A(ex) \ 01529 (void)((ex) || (Y(assertion_failed)(#ex, __LINE__, __FILE__), 0)) 01530 #else 01531 #define A(ex) /* nothing */ 01532 #endif 01533 01537 #endif