40 #include <sys/types.h>
56 #define CONCAT(prefix, name) prefix ## name
57 #if defined(NFFT_SINGLE)
59 typedef float _Complex C;
60 #define Y(name) CONCAT(nfftf_,name)
61 #define Z(name) CONCAT(fftwf_,name)
62 #define NFSFT(name) CONCAT(nfsftf_,name)
63 #elif defined(NFFT_LDOUBLE)
64 typedef long double R;
65 typedef long double _Complex C;
66 #define Y(name) CONCAT(nfftl_,name)
67 #define Z(name) CONCAT(fftwl_,name)
68 #define NFSFT(name) CONCAT(nfsftl_,name)
71 typedef double _Complex C;
72 #define Y(name) CONCAT(nfft_,name)
73 #define Z(name) CONCAT(fftw_,name)
74 #define NFSFT(name) CONCAT(nfsft_,name)
76 #define X(name) Y(name)
78 #define STRINGIZEx(x) #x
79 #define STRINGIZE(x) STRINGIZEx(x)
82 # define K(x) ((R) x##L)
86 #define DK(name, value) const R name = K(value)
90 typedef ptrdiff_t INT;
92 #define KPI K(3.1415926535897932384626433832795028841971693993751)
93 #define K2PI K(6.2831853071795864769252867665590057683943387987502)
94 #define KE K(2.7182818284590452353602874713526624977572470937000)
96 #define IF(x,a,b) ((x)?(a):(b))
97 #define MIN(a,b) (((a)<(b))?(a):(b))
98 #define MAX(a,b) (((a)>(b))?(a):(b))
99 #define ABS(x) (((x)>K(0.0))?(x):(-(x)))
100 #define SIGN(a) (((a)>=0)?1:-1)
101 #define SIGN(a) (((a)>=0)?1:-1)
102 #define SIGNF(a) IF((a)<K(0.0),K(-1.0),K(1.0))
106 #if defined(DIRAC_DELTA)
107 #define PHI_HUT(k,d) K(1.0)
108 #define PHI(x,d) IF(FABS((x)) < K(10E-8),K(1.0),K(0.0))
109 #define WINDOW_HELP_INIT(d)
110 #define WINDOW_HELP_FINALIZE
111 #define WINDOW_HELP_ESTIMATE_m 0
112 #elif defined(GAUSSIAN)
113 #define PHI_HUT(k,d) ((R)EXP(-(POW(KPI*(k)/ths->n[d],K(2.0))*ths->b[d])))
114 #define PHI(x,d) ((R)EXP(-POW((x)*((R)ths->n[d]),K(2.0)) / \
115 ths->b[d])/SQRT(KPI*ths->b[d]))
116 #define WINDOW_HELP_INIT \
119 ths->b = (R*) Y(malloc)(ths->d*sizeof(R)); \
120 for (WINDOW_idx = 0; WINDOW_idx < ths->d; WINDOW_idx++) \
121 ths->b[WINDOW_idx]=(K(2.0)*ths->sigma[WINDOW_idx]) / \
122 (K(2.0)*ths->sigma[WINDOW_idx] - K(1.0)) * (((R)ths->m) / KPI); \
124 #define WINDOW_HELP_FINALIZE {Y(free)(ths->b);}
125 #define WINDOW_HELP_ESTIMATE_m 12
126 #elif defined(B_SPLINE)
127 #define PHI_HUT(k,d) ((R)(((k) == 0) ? K(1.0) / ths->n[(d)] : \
128 POW(SIN((k) * KPI / ths->n[(d)]) / ((k) * KPI / ths->n[(d)]), \
129 K(2.0) * ths->m)/ths->n[(d)]))
130 #define PHI(x,d) (Y(bspline)(2*ths->m,((x)*ths->n[(d)]) + \
131 (R)ths->m,ths->spline_coeffs) / ths->n[(d)])
132 #define WINDOW_HELP_INIT \
134 ths->spline_coeffs= (R*)Y(malloc)(2*ths->m*sizeof(R)); \
136 #define WINDOW_HELP_FINALIZE {Y(free)(ths->spline_coeffs);}
137 #define WINDOW_HELP_ESTIMATE_m 11
138 #elif defined(SINC_POWER)
139 #define PHI_HUT(k,d) (Y(bspline)(2 * ths->m, (K(2.0) * ths->m*(k)) / \
140 ((K(2.0) * ths->sigma[(d)] - 1) * ths->n[(d)] / \
141 ths->sigma[(d)]) + (R)ths->m, ths->spline_coeffs))
142 #define PHI(x,d) ((R)(ths->n[(d)] / ths->sigma[(d)] * \
143 (K(2.0) * ths->sigma[(d)] - K(1.0))/ (K(2.0)*ths->m) * \
144 POW(Y(sinc)(KPI * ths->n[(d)] / ths->sigma[(d)] * (x) * \
145 (K(2.0) * ths->sigma[(d)] - K(1.0)) / (K(2.0)*ths->m)) , 2*ths->m) / \
147 #define WINDOW_HELP_INIT \
149 ths->spline_coeffs= (R*)Y(malloc)(2 * ths->m * sizeof(R)); \
151 #define WINDOW_HELP_FINALIZE {Y(free)(ths->spline_coeffs);}
152 #define WINDOW_HELP_ESTIMATE_m 9
154 #define PHI_HUT(k,d) ((R)Y(bessel_i0)(ths->m * SQRT(\
155 POW((R)(ths->b[d]), K(2.0)) - POW(K(2.0) * KPI * (k) / ths->n[d], K(2.0)))))
156 #define PHI(x,d) ((R)((POW((R)(ths->m), K(2.0))\
157 -POW((x)*ths->n[d],K(2.0))) > 0)? \
158 SINH(ths->b[d] * SQRT(POW((R)(ths->m),K(2.0)) - \
159 POW((x)*ths->n[d],K(2.0))))/(KPI*SQRT(POW((R)(ths->m),K(2.0)) - \
160 POW((x)*ths->n[d],K(2.0)))) : (((POW((R)(ths->m),K(2.0)) - \
161 POW((x)*ths->n[d],K(2.0))) < 0)? SIN(ths->b[d] * \
162 SQRT(POW(ths->n[d]*(x),K(2.0)) - POW((R)(ths->m), K(2.0)))) / \
163 (KPI*SQRT(POW(ths->n[d]*(x),K(2.0)) - POW((R)(ths->m),K(2.0)))):K(1.0)))
164 #define WINDOW_HELP_INIT \
167 ths->b = (R*) Y(malloc)(ths->d*sizeof(R)); \
168 for (WINDOW_idx = 0; WINDOW_idx < ths->d; WINDOW_idx++) \
169 ths->b[WINDOW_idx] = ((R)KPI*(K(2.0)-K(1.0) / ths->sigma[WINDOW_idx])); \
171 #define WINDOW_HELP_FINALIZE {Y(free)(ths->b);}
172 #define WINDOW_HELP_ESTIMATE_m 6
175 #if defined(NFFT_LDOUBLE)
176 #if HAVE_DECL_COPYSIGNL == 0
177 extern long double copysignl(
long double,
long double);
179 #if HAVE_DECL_NEXTAFTERL == 0
180 extern long double nextafterl(
long double,
long double);
182 #if HAVE_DECL_NANL == 0
183 extern long double nanl(
const char *tag);
185 #if HAVE_DECL_CEILL == 0
186 extern long double ceill(
long double);
188 #if HAVE_DECL_FLOORL == 0
189 extern long double floorl(
long double);
191 #if HAVE_DECL_NEARBYINTL == 0
192 extern long double nearbyintl(
long double);
194 #if HAVE_DECL_RINTL == 0
195 extern long double rintl(
long double);
197 #if HAVE_DECL_ROUNDL == 0
198 extern long double roundl(
long double);
200 #if HAVE_DECL_LRINTL == 0
201 extern long int lrintl(
long double);
203 #if HAVE_DECL_LROUNDL == 0
204 extern long int lroundl(
long double);
206 #if HAVE_DECL_LLRINTL == 0
207 extern long long int llrintl(
long double);
209 #if HAVE_DECL_LLROUNDL == 0
210 extern long long int llroundl(
long double);
212 #if HAVE_DECL_TRUNCL == 0
213 extern long double truncl(
long double);
215 #if HAVE_DECL_FMODL == 0
216 extern long double fmodl(
long double,
long double);
218 #if HAVE_DECL_REMAINDERL == 0
219 extern long double remainderl(
long double,
long double);
221 #if HAVE_DECL_REMQUOL == 0
222 extern long double remquol(
long double x,
long double y,
int *);
224 #if HAVE_DECL_FDIML == 0
225 extern long double fdiml(
long double,
long double);
227 #if HAVE_DECL_FMAXL == 0
228 extern long double fmaxl(
long double,
long double);
230 #if HAVE_DECL_FMINL == 0
231 extern long double fminl(
long double,
long double);
233 #if HAVE_DECL_FMAL == 0
234 extern long double fmal(
long double x,
long double y,
long double z);
236 #if HAVE_DECL_FABSL == 0
237 extern long double fabsl(
long double);
239 #if HAVE_DECL_SQRTL == 0
240 extern long double sqrtl(
long double);
242 #if HAVE_DECL_CBRTL == 0
243 extern long double cbrtl(
long double);
245 #if HAVE_DECL_HYPOTL == 0
246 extern long double hypotl(
long double,
long double);
248 #if HAVE_DECL_EXPL == 0
249 extern long double expl(
long double);
251 #if HAVE_DECL_EXP2L == 0
252 extern long double exp2l(
long double);
254 #if HAVE_DECL_EXPM1L == 0
255 extern long double expm1l(
long double);
257 #if HAVE_DECL_LOGL == 0
258 extern long double logl(
long double);
260 #if HAVE_DECL_LOG2L == 0
261 extern long double log2l(
long double);
263 #if HAVE_DECL_LOG10L == 0
264 extern long double log10l(
long double);
266 #if HAVE_DECL_LOG1PL == 0
267 extern long double log1pl(
long double);
269 #if HAVE_DECL_LOGBL == 0
270 extern long double logbl(
long double);
272 #if HAVE_DECL_ILOGBL == 0
273 extern int ilogbl(
long double);
275 #if HAVE_DECL_MODFL == 0
276 extern long double modfl(
long double,
long double *);
278 #if HAVE_DECL_FREXPL == 0
279 extern long double frexpl(
long double,
int *);
281 #if HAVE_DECL_LDEXPL == 0
282 extern long double ldexpl(
long double,
int);
284 #if HAVE_DECL_SCALBNL == 0
285 extern long double scalbnl(
long double,
int);
287 #if HAVE_DECL_SCALBLNL == 0
288 extern long double scalblnl(
long double,
long int);
290 #if HAVE_DECL_POWL == 0
291 extern long double powl(
long double,
long double);
293 #if HAVE_DECL_COSL == 0
294 extern long double cosl(
long double);
296 #if HAVE_DECL_SINL == 0
297 extern long double sinl(
long double);
299 #if HAVE_DECL_TANL == 0
300 extern long double tanl(
long double);
302 #if HAVE_DECL_COSHL == 0
303 extern long double coshl(
long double);
305 #if HAVE_DECL_SINHL == 0
306 extern long double sinhl(
long double);
308 #if HAVE_DECL_TANHL == 0
309 extern long double tanhl(
long double);
311 #if HAVE_DECL_ACOSL == 0
312 extern long double acosl(
long double);
314 #if HAVE_DECL_ASINL == 0
315 extern long double asinl(
long double);
317 #if HAVE_DECL_ATANL == 0
318 extern long double atanl(
long double);
320 #if HAVE_DECL_ATAN2L == 0
321 extern long double atan2l(
long double,
long double);
323 #if HAVE_DECL_ACOSHL == 0
324 extern long double acoshl(
long double);
326 #if HAVE_DECL_ASINHL == 0
327 extern long double asinhl(
long double);
329 #if HAVE_DECL_ATANHL == 0
330 extern long double atanhl(
long double);
332 #if HAVE_DECL_TGAMMAL == 0
333 extern long double tgammal(
long double);
335 #if HAVE_DECL_LGAMMAL == 0
336 extern long double lgammal(
long double);
338 #if HAVE_DECL_J0L == 0
339 extern long double j0l(
long double);
341 #if HAVE_DECL_J1L == 0
342 extern long double j1l(
long double);
344 #if HAVE_DECL_JNL == 0
345 extern long double jnl(
int,
long double);
347 #if HAVE_DECL_Y0L == 0
348 extern long double y0l(
long double);
350 #if HAVE_DECL_Y1L == 0
351 extern long double y1l(
long double);
353 #if HAVE_DECL_YNL == 0
354 extern long double ynl(
int,
long double);
356 #if HAVE_DECL_ERFL == 0
357 extern long double erfl(
long double);
359 #if HAVE_DECL_ERFCL == 0
360 extern long double erfcl(
long double);
362 #if HAVE_DECL_CREALL == 0
363 extern long double creall(
long double _Complex z);
365 #if HAVE_DECL_CIMAGL == 0
366 extern long double cimagl(
long double _Complex z);
368 #if HAVE_DECL_CABSL == 0
369 extern long double cabsl(
long double _Complex z);
371 #if HAVE_DECL_CARGL == 0
372 extern long double cargl(
long double _Complex z);
374 #if HAVE_DECL_CONJL == 0
375 extern long double _Complex conjl(
long double _Complex z);
377 #if HAVE_DECL_CPROJL == 0
378 extern long double _Complex cprojl(
long double _Complex z);
380 #if HAVE_DECL_CSQRTL == 0
381 extern long double _Complex csqrtl(
long double _Complex z);
383 #if HAVE_DECL_CEXPL == 0
384 extern long double _Complex cexpl(
long double _Complex z);
386 #if HAVE_DECL_CLOGL == 0
387 extern long double _Complex clogl(
long double _Complex z);
389 #if HAVE_DECL_CPOWL == 0
390 extern long double _Complex cpowl(
long double _Complex z,
long double _Complex w);
392 #if HAVE_DECL_CSINL == 0
393 extern long double _Complex csinl(
long double _Complex z);
395 #if HAVE_DECL_CCOSL == 0
396 extern long double _Complex ccosl(
long double _Complex z);
398 #if HAVE_DECL_CTANL == 0
399 extern long double _Complex ctanl(
long double _Complex z);
401 #if HAVE_DECL_CASINL == 0
402 extern long double _Complex casinl(
long double _Complex z);
404 #if HAVE_DECL_CACOSL == 0
405 extern long double _Complex cacosl(
long double _Complex z);
407 #if HAVE_DECL_CATANL == 0
408 extern long double _Complex catanl(
long double _Complex z);
410 #if HAVE_DECL_CSINHL == 0
411 extern long double _Complex csinhl(
long double _Complex z);
413 #if HAVE_DECL_CCOSHL == 0
414 extern long double _Complex ccoshl(
long double _Complex z);
416 #if HAVE_DECL_CTANHL == 0
417 extern long double _Complex ctanhl(
long double _Complex z);
419 #if HAVE_DECL_CASINHL == 0
420 extern long double _Complex casinhl(
long double _Complex z);
422 #if HAVE_DECL_CACOSHL == 0
423 extern long double _Complex cacoshl(
long double _Complex z);
425 #if HAVE_DECL_CATANHL == 0
426 extern long double _Complex catanhl(
long double _Complex z);
428 #define COPYSIGN copysignl
429 #define NEXTAFTER nextafterl
433 #define NEARBYINT nearbyintl
437 #define LROUND lroundl
438 #define LLRINT llrintl
439 #define LLROUND llroundl
442 #define REMAINDER remainderl
443 #define REMQUO remquol
464 #define SCALBN scalbnl
465 #define SCALBLN scalblnl
480 #define TGAMMA tgammal
481 #define LGAMMA lgammal
509 #define CASINH casinhl
510 #define CACOSH cacoshl
511 #define CATANH catanhl
512 #elif defined(NFFT_SINGLE)
513 #if HAVE_DECL_COPYSIGNF == 0
514 extern float copysignf(
float,
float);
516 #if HAVE_DECL_NEXTAFTERF == 0
517 extern float nextafterf(
float,
float);
519 #if HAVE_DECL_NANF == 0
520 extern float nanf(
const char *tag);
522 #if HAVE_DECL_CEILF == 0
523 extern float ceilf(
float);
525 #if HAVE_DECL_FLOORF == 0
526 extern float floorf(
float);
528 #if HAVE_DECL_NEARBYINTF == 0
529 extern float nearbyintf(
float);
531 #if HAVE_DECL_RINTF == 0
532 extern float rintf(
float);
534 #if HAVE_DECL_ROUNDF == 0
535 extern float roundf(
float);
537 #if HAVE_DECL_LRINTF == 0
538 extern long int lrintf(
float);
540 #if HAVE_DECL_LROUNDF == 0
541 extern long int lroundf(
float);
543 #if HAVE_DECL_LLRINTF == 0
544 extern long long int llrintf(
float);
546 #if HAVE_DECL_LLROUNDF == 0
547 extern long long int llroundf(
float);
549 #if HAVE_DECL_TRUNCF == 0
550 extern float truncf(
float);
552 #if HAVE_DECL_FMODF == 0
553 extern float fmodf(
float,
float);
555 #if HAVE_DECL_REMAINDERF == 0
556 extern float remainderf(
float,
float);
558 #if HAVE_DECL_REMQUOF == 0
559 extern float remquof(
float x,
float y,
int *);
561 #if HAVE_DECL_FDIMF == 0
562 extern float fdimf(
float,
float);
564 #if HAVE_DECL_FMAXF == 0
565 extern float fmaxf(
float,
float);
567 #if HAVE_DECL_FMINF == 0
568 extern float fminf(
float,
float);
570 #if HAVE_DECL_FMAF == 0
571 extern float fmaf(
float x,
float y,
float z);
573 #if HAVE_DECL_FABSF == 0
574 extern float fabsf(
float);
576 #if HAVE_DECL_SQRTF == 0
577 extern float sqrtf(
float);
579 #if HAVE_DECL_CBRTF == 0
580 extern float cbrtf(
float);
582 #if HAVE_DECL_HYPOTF == 0
583 extern float hypotf(
float,
float);
585 #if HAVE_DECL_EXPF == 0
586 extern float expf(
float);
588 #if HAVE_DECL_EXP2F == 0
589 extern float exp2f(
float);
591 #if HAVE_DECL_EXPM1F == 0
592 extern float expm1f(
float);
594 #if HAVE_DECL_LOGF == 0
595 extern float logf(
float);
597 #if HAVE_DECL_LOG2F == 0
598 extern float log2f(
float);
600 #if HAVE_DECL_LOG10F == 0
601 extern float log10f(
float);
603 #if HAVE_DECL_LOG1PF == 0
604 extern float log1pf(
float);
606 #if HAVE_DECL_LOGBF == 0
607 extern float logbf(
float);
609 #if HAVE_DECL_ILOGBF == 0
610 extern int ilogbf(
float);
612 #if HAVE_DECL_MODFF == 0
613 extern float modff(
float,
float *);
615 #if HAVE_DECL_FREXPF == 0
616 extern float frexpf(
float,
int *);
618 #if HAVE_DECL_LDEXPF == 0
619 extern float ldexpf(
float,
int);
621 #if HAVE_DECL_SCALBNF == 0
622 extern float scalbnf(
float,
int);
624 #if HAVE_DECL_SCALBLNF == 0
625 extern float scalblnf(
float,
long int);
627 #if HAVE_DECL_POWF == 0
628 extern float powf(
float,
float);
630 #if HAVE_DECL_COSF == 0
631 extern float cosf(
float);
633 #if HAVE_DECL_SINF == 0
634 extern float sinf(
float);
636 #if HAVE_DECL_TANF == 0
637 extern float tanf(
float);
639 #if HAVE_DECL_COSHF == 0
640 extern float coshf(
float);
642 #if HAVE_DECL_SINHF == 0
643 extern float sinhf(
float);
645 #if HAVE_DECL_TANHF == 0
646 extern float tanhf(
float);
648 #if HAVE_DECL_ACOSF == 0
649 extern float acosf(
float);
651 #if HAVE_DECL_ASINF == 0
652 extern float asinf(
float);
654 #if HAVE_DECL_ATANF == 0
655 extern float atanf(
float);
657 #if HAVE_DECL_ATAN2F == 0
658 extern float atan2f(
float,
float);
660 #if HAVE_DECL_ACOSHF == 0
661 extern float acoshf(
float);
663 #if HAVE_DECL_ASINHF == 0
664 extern float asinhf(
float);
666 #if HAVE_DECL_ATANHF == 0
667 extern float atanhf(
float);
669 #if HAVE_DECL_TGAMMAF == 0
670 extern float tgammaf(
float);
672 #if HAVE_DECL_LGAMMAF == 0
673 extern float lgammaf(
float);
675 #if HAVE_DECL_J0F == 0
676 extern float j0f(
float);
678 #if HAVE_DECL_J1F == 0
679 extern float j1f(
float);
681 #if HAVE_DECL_JNF == 0
682 extern float jnf(
int,
float);
684 #if HAVE_DECL_Y0F == 0
685 extern float y0f(
float);
687 #if HAVE_DECL_Y1F == 0
688 extern float y1f(
float);
690 #if HAVE_DECL_YNF == 0
691 extern float ynf(
int,
float);
693 #if HAVE_DECL_ERFF == 0
694 extern float erff(
float);
696 #if HAVE_DECL_ERFCF == 0
697 extern float erfcf(
float);
699 #if HAVE_DECL_CREALF == 0
700 extern float crealf(
float _Complex z);
702 #if HAVE_DECL_CIMAGF == 0
703 extern float cimagf(
float _Complex z);
705 #if HAVE_DECL_CABSF == 0
706 extern float cabsf(
float _Complex z);
708 #if HAVE_DECL_CARGF == 0
709 extern float cargf(
float _Complex z);
711 #if HAVE_DECL_CONJF == 0
712 extern float _Complex conjf(
float _Complex z);
714 #if HAVE_DECL_CPROJF == 0
715 extern float _Complex cprojf(
float _Complex z);
717 #if HAVE_DECL_CSQRTF == 0
718 extern float _Complex csqrtf(
float _Complex z);
720 #if HAVE_DECL_CEXPF == 0
721 extern float _Complex cexpf(
float _Complex z);
723 #if HAVE_DECL_CLOGF == 0
724 extern float _Complex clogf(
float _Complex z);
726 #if HAVE_DECL_CPOWF == 0
727 extern float _Complex cpowf(
float _Complex z,
float _Complex w);
729 #if HAVE_DECL_CSINF == 0
730 extern float _Complex csinf(
float _Complex z);
732 #if HAVE_DECL_CCOSF == 0
733 extern float _Complex ccosf(
float _Complex z);
735 #if HAVE_DECL_CTANF == 0
736 extern float _Complex ctanf(
float _Complex z);
738 #if HAVE_DECL_CASINF == 0
739 extern float _Complex casinf(
float _Complex z);
741 #if HAVE_DECL_CACOSF == 0
742 extern float _Complex cacosf(
float _Complex z);
744 #if HAVE_DECL_CATANF == 0
745 extern float _Complex catanf(
float _Complex z);
747 #if HAVE_DECL_CSINHF == 0
748 extern float _Complex csinhf(
float _Complex z);
750 #if HAVE_DECL_CCOSHF == 0
751 extern float _Complex ccoshf(
float _Complex z);
753 #if HAVE_DECL_CTANHF == 0
754 extern float _Complex ctanhf(
float _Complex z);
756 #if HAVE_DECL_CASINHF == 0
757 extern float _Complex casinhf(
float _Complex z);
759 #if HAVE_DECL_CACOSHF == 0
760 extern float _Complex cacoshf(
float _Complex z);
762 #if HAVE_DECL_CATANHF == 0
763 extern float _Complex catanhf(
float _Complex z);
765 #define COPYSIGN copysignf
766 #define NEXTAFTER nextafterf
770 #define NEARBYINT nearbyintf
774 #define LROUND lroundf
775 #define LLRINT llrintf
776 #define LLROUND llroundf
779 #define REMAINDER remainderf
780 #define REMQUO remquof
801 #define SCALBN scalbnf
802 #define SCALBLN scalblnf
817 #define TGAMMA tgammaf
818 #define LGAMMA lgammaf
846 #define CASINH casinhf
847 #define CACOSH cacoshf
848 #define CATANH catanhf
850 #if HAVE_DECL_COPYSIGN == 0
851 extern double copysign(
double,
double);
853 #if HAVE_DECL_NEXTAFTER == 0
854 extern double nextafter(
double,
double);
856 #if HAVE_DECL_NAN == 0
857 extern double nan(
const char *tag);
859 #if HAVE_DECL_CEIL == 0
860 extern double ceil(
double);
862 #if HAVE_DECL_FLOOR == 0
863 extern double floor(
double);
865 #if HAVE_DECL_NEARBYINT == 0
866 extern double nearbyint(
double);
868 #if HAVE_DECL_RINT == 0
869 extern double rint(
double);
871 #if HAVE_DECL_ROUND == 0
872 extern double round(
double);
874 #if HAVE_DECL_LRINT == 0
875 extern long int lrint(
double);
877 #if HAVE_DECL_LROUND == 0
878 extern long int lround(
double);
880 #if HAVE_DECL_LLRINT == 0
881 extern long long int llrint(
double);
883 #if HAVE_DECL_LLROUND == 0
884 extern long long int llround(
double);
886 #if HAVE_DECL_TRUNC == 0
887 extern double trunc(
double);
889 #if HAVE_DECL_FMOD == 0
890 extern double fmod(
double,
double);
892 #if HAVE_DECL_REMAINDER == 0
893 extern double remainder(
double,
double);
895 #if HAVE_DECL_REMQUO == 0
896 extern double remquo(
double x,
double y,
int *);
898 #if HAVE_DECL_FDIM == 0
899 extern double fdim(
double,
double);
901 #if HAVE_DECL_FMAX == 0
902 extern double fmax(
double,
double);
904 #if HAVE_DECL_FMIN == 0
905 extern double fmin(
double,
double);
907 #if HAVE_DECL_FMA == 0
908 extern double fma(
double x,
double y,
double z);
910 #if HAVE_DECL_FABS == 0
911 extern double fabs(
double);
913 #if HAVE_DECL_SQRT == 0
914 extern double sqrt(
double);
916 #if HAVE_DECL_CBRT == 0
917 extern double cbrt(
double);
919 #if HAVE_DECL_HYPOT == 0
920 extern double hypot(
double,
double);
922 #if HAVE_DECL_EXP == 0
923 extern double exp(
double);
925 #if HAVE_DECL_EXP2 == 0
926 extern double exp2(
double);
928 #if HAVE_DECL_EXPM1 == 0
929 extern double expm1(
double);
931 #if HAVE_DECL_LOG == 0
932 extern double log(
double);
934 #if HAVE_DECL_LOG2 == 0
935 extern double log2(
double);
937 #if HAVE_DECL_LOG10 == 0
938 extern double log10(
double);
940 #if HAVE_DECL_LOG1P == 0
941 extern double log1p(
double);
943 #if HAVE_DECL_LOGB == 0
944 extern double logb(
double);
946 #if HAVE_DECL_ILOGB == 0
947 extern int ilogb(
double);
949 #if HAVE_DECL_MODF == 0
950 extern double modf(
double,
double *);
952 #if HAVE_DECL_FREXP == 0
953 extern double frexp(
double,
int *);
955 #if HAVE_DECL_LDEXP == 0
956 extern double ldexp(
double,
int);
958 #if HAVE_DECL_SCALBN == 0
959 extern double scalbn(
double,
int);
961 #if HAVE_DECL_SCALBLN == 0
962 extern double scalbln(
double,
long int);
964 #if HAVE_DECL_POW == 0
965 extern double pow(
double,
double);
967 #if HAVE_DECL_COS == 0
968 extern double cos(
double);
970 #if HAVE_DECL_SIN == 0
971 extern double sin(
double);
973 #if HAVE_DECL_TAN == 0
974 extern double tan(
double);
976 #if HAVE_DECL_COSH == 0
977 extern double cosh(
double);
979 #if HAVE_DECL_SINH == 0
980 extern double sinh(
double);
982 #if HAVE_DECL_TANH == 0
983 extern double tanh(
double);
985 #if HAVE_DECL_ACOS == 0
986 extern double acos(
double);
988 #if HAVE_DECL_ASIN == 0
989 extern double asin(
double);
991 #if HAVE_DECL_ATAN == 0
992 extern double atan(
double);
994 #if HAVE_DECL_ATAN2 == 0
995 extern double atan2(
double,
double);
997 #if HAVE_DECL_ACOSH == 0
998 extern double acosh(
double);
1000 #if HAVE_DECL_ASINH == 0
1001 extern double asinh(
double);
1003 #if HAVE_DECL_ATANH == 0
1004 extern double atanh(
double);
1006 #if HAVE_DECL_TGAMMA == 0
1007 extern double tgamma(
double);
1009 #if HAVE_DECL_LGAMMA == 0
1010 extern double lgamma(
double);
1012 #if HAVE_DECL_J0 == 0
1013 extern double j0(
double);
1015 #if HAVE_DECL_J1 == 0
1016 extern double j1(
double);
1018 #if HAVE_DECL_JN == 0
1019 extern double jn(
int,
double);
1021 #if HAVE_DECL_Y0 == 0
1022 extern double y0(
double);
1024 #if HAVE_DECL_Y1 == 0
1025 extern double y1(
double);
1027 #if HAVE_DECL_YN == 0
1028 extern double yn(
int,
double);
1030 #if HAVE_DECL_ERF == 0
1031 extern double erf(
double);
1033 #if HAVE_DECL_ERFC == 0
1034 extern double erfc(
double);
1036 #if HAVE_DECL_CREAL == 0
1037 extern double creal(
double _Complex z);
1039 #if HAVE_DECL_CIMAG == 0
1040 extern double cimag(
double _Complex z);
1042 #if HAVE_DECL_CABS == 0
1043 extern double cabs(
double _Complex z);
1045 #if HAVE_DECL_CARG == 0
1046 extern double carg(
double _Complex z);
1048 #if HAVE_DECL_CONJ == 0
1049 extern double _Complex conj(
double _Complex z);
1051 #if HAVE_DECL_CPROJ == 0
1052 extern double _Complex cproj(
double _Complex z);
1054 #if HAVE_DECL_CSQRT == 0
1055 extern double _Complex csqrt(
double _Complex z);
1057 #if HAVE_DECL_CEXP == 0
1058 extern double _Complex cexp(
double _Complex z);
1060 #if HAVE_DECL_CLOG == 0
1061 extern double _Complex clog(
double _Complex z);
1063 #if HAVE_DECL_CPOW == 0
1064 extern double _Complex cpow(
double _Complex z,
double _Complex w);
1066 #if HAVE_DECL_CSIN == 0
1067 extern double _Complex csin(
double _Complex z);
1069 #if HAVE_DECL_CCOS == 0
1070 extern double _Complex ccos(
double _Complex z);
1072 #if HAVE_DECL_CTAN == 0
1073 extern double _Complex ctan(
double _Complex z);
1075 #if HAVE_DECL_CASIN == 0
1076 extern double _Complex casin(
double _Complex z);
1078 #if HAVE_DECL_CACOS == 0
1079 extern double _Complex cacos(
double _Complex z);
1081 #if HAVE_DECL_CATAN == 0
1082 extern double _Complex catan(
double _Complex z);
1084 #if HAVE_DECL_CSINH == 0
1085 extern double _Complex csinh(
double _Complex z);
1087 #if HAVE_DECL_CCOSH == 0
1088 extern double _Complex ccosh(
double _Complex z);
1090 #if HAVE_DECL_CTANH == 0
1091 extern double _Complex ctanh(
double _Complex z);
1093 #if HAVE_DECL_CASINH == 0
1094 extern double _Complex casinh(
double _Complex z);
1096 #if HAVE_DECL_CACOSH == 0
1097 extern double _Complex cacosh(
double _Complex z);
1099 #if HAVE_DECL_CATANH == 0
1100 extern double _Complex catanh(
double _Complex z);
1102 #define COPYSIGN copysign
1103 #define NEXTAFTER nextafter
1107 #define NEARBYINT nearbyint
1111 #define LROUND lround
1112 #define LLRINT llrint
1113 #define LLROUND llround
1116 #define REMAINDER remainder
1117 #define REMQUO remquo
1138 #define SCALBN scalbn
1139 #define SCALBLN scalbln
1154 #define TGAMMA tgamma
1155 #define LGAMMA lgamma
1183 #define CASINH casinh
1184 #define CACOSH cacosh
1185 #define CATANH catanh
1188 #if defined(NFFT_LDOUBLE)
1189 #define EPSILON LDBL_EPSILON//4.0E-31L
1190 #define MANT_DIG LDBL_MANT_DIG
1191 #define MIN_EXP LDBL_MIN_EXP
1192 #define MAX_EXP LDBL_MAX_EXP
1193 #elif defined(NFFT_SINGLE)
1194 #define EPSILON FLT_EPSILON
1195 #define MANT_DIG FLT_MANT_DIG
1196 #define MIN_EXP FLT_MIN_EXP
1197 #define MAX_EXP FLT_MAX_EXP
1199 #define EPSILON DBL_EPSILON
1200 #define MANT_DIG DBL_MANT_DIG
1201 #define MIN_EXP DBL_MIN_EXP
1202 #define MAX_EXP DBL_MAX_EXP
1205 #if defined(FLT_ROUND)
1207 #define FLTROUND 1.0
1209 #define FLTROUND 0.0
1212 #define FLTROUND 0.0
1215 #if HAVE_DECL_DRAND48 == 0
1216 extern double drand48(
void);
1218 #if HAVE_DECL_SRAND48 == 0
1219 extern void srand48(
long int);
1221 #define R_RADIX FLT_RADIX
1222 #define II _Complex_I
1225 #if defined(NFFT_LDOUBLE)
1227 # define FE_ "% 36.32LE"
1229 #elif defined(NFFT_SINGLE)
1231 # define FE_ "% 12.8E"
1235 # define FE_ "% 20.16lE"
1243 #define UNUSED(x) (void)x
1245 extern void nfft_assertion_failed(
const char *s,
int line,
const char *file);
1249 (void)((ex) || (nfft_assertion_failed(#ex, __LINE__, __FILE__), 0))
1254 (void)((ex) || (nfft_assertion_failed(#ex, __LINE__, __FILE__), 0))
1264 #define alloca __builtin_alloca
1271 #define alloca _alloca
1285 void *alloca(
size_t);
1293 #define STACK_MALLOC(T, p, x) p = (T)alloca(x)
1294 #define STACK_FREE(x)
1298 #define STACK_MALLOC(T, p, x) p = (T)nfft_malloc(x)
1299 #define STACK_FREE(x) nfft_free(x)
1303 double nfft_elapsed_seconds(ticks t1, ticks t0);
1306 #define UNUSED(x) (void)x
1316 double MEASURE_TIME_tt;
1317 ticks MEASURE_TIME_t0, MEASURE_TIME_t1;
1320 ths->MEASURE_TIME_t[(a)]=0; \
1326 MEASURE_TIME_t0 = getticks(); \
1331 MEASURE_TIME_t1 = getticks(); \
1332 MEASURE_TIME_tt = nfft_elapsed_seconds(MEASURE_TIME_t1,MEASURE_TIME_t0);\
1333 ths->MEASURE_TIME_t[(a)]+=MEASURE_TIME_tt; \
1335 ths->MEASURE_TIME_t[(a)]/=MEASURE_TIME_r; \
1342 #ifdef MEASURE_TIME_FFTW
1343 #define TIC_FFTW(a) TIC(a)
1344 #define TOC_FFTW(a) TOC(a)
1358 R X(lambda)(R z, R eps);
1361 R X(lambda2)(R mu, R nu);
1364 R X(bessel_i0)(R x);
1367 typedef enum {NFFT_EPSILON = 0, NFFT_SAFE_MIN = 1, NFFT_BASE = 2,
1368 NFFT_PRECISION = 3, NFFT_MANT_DIG = 4, NFFT_FLTROUND = 5, NFFT_E_MIN = 6,
1369 NFFT_R_MIN = 7, NFFT_E_MAX = 8, NFFT_R_MAX = 9} float_property;
1371 R X(float_property)(float_property);
1374 int X(exp2i)(
const int a);
1375 int X(log2i)(
const int m);
1376 int X(next_power_of_2)(
const int N);
1377 void X(next_power_of_2_exp)(
const int N,
int *N2,
int *t);
1380 R X(error_l_infty_complex)(
const C *x,
const C *y,
const INT n);
1381 R X(error_l_infty_double)(
const R *x,
const R *y,
const INT n);
1382 R X(error_l_infty_1_complex)(
const C *x,
const C *y,
const INT n,
1383 const C *z,
const INT m);
1384 R X(error_l_infty_1_double)(
const R *x,
const R *y,
const INT n,
const R *z,
1386 R X(error_l_2_complex)(
const C *x,
const C *y,
const INT n);
1387 R X(error_l_2_double)(
const R *x,
const R *y,
const INT n);