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

Generated on Fri Oct 12 2012 by Doxygen 1.8.0-20120409