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