42 #include <sys/types.h>
69 #define CONCAT(prefix, name) prefix ## name
70 #if defined(NFFT_SINGLE)
72 typedef float _Complex C;
73 #define Y(name) CONCAT(nfftf_,name)
74 #define FFTW(name) CONCAT(fftwf_,name)
75 #define NFFT(name) CONCAT(nfftf_,name)
76 #define NFCT(name) CONCAT(nfctf_,name)
77 #define NFST(name) CONCAT(nfstf_,name)
78 #define NFSFT(name) CONCAT(nfsftf_,name)
79 #define SOLVER(name) CONCAT(solverf_,name)
80 #elif defined(NFFT_LDOUBLE)
81 typedef long double R;
82 typedef long double _Complex C;
83 #define Y(name) CONCAT(nfftl_,name)
84 #define FFTW(name) CONCAT(fftwl_,name)
85 #define NFFT(name) CONCAT(nfftl_,name)
86 #define NFCT(name) CONCAT(nfctl_,name)
87 #define NFST(name) CONCAT(nfstl_,name)
88 #define NFSFT(name) CONCAT(nfsftl_,name)
89 #define SOLVER(name) CONCAT(solverl_,name)
92 typedef double _Complex C;
93 #define Y(name) CONCAT(nfft_,name)
94 #define FFTW(name) CONCAT(fftw_,name)
95 #define NFFT(name) CONCAT(nfft_,name)
96 #define NFCT(name) CONCAT(nfct_,name)
97 #define NFST(name) CONCAT(nfst_,name)
98 #define NFSFT(name) CONCAT(nfsft_,name)
99 #define SOLVER(name) CONCAT(solver_,name)
101 #define X(name) Y(name)
103 #define STRINGIZEx(x) #x
104 #define STRINGIZE(x) STRINGIZEx(x)
107 # define K(x) ((R) x##L)
109 # define K(x) ((R) x)
111 #define DK(name, value) const R name = K(value)
113 #if defined __CYGWIN32__ && !defined __CYGWIN__
117 # define __CYGWIN__ __CYGWIN32__
120 #if defined _WIN32 && !defined __CYGWIN__
133 typedef ptrdiff_t INT;
135 #define KPI K(3.1415926535897932384626433832795028841971693993751)
136 #define K2PI K(6.2831853071795864769252867665590057683943387987502)
137 #define K4PI K(12.5663706143591729538505735331180115367886775975004)
138 #define KE K(2.7182818284590452353602874713526624977572470937000)
140 #define IF(x,a,b) ((x)?(a):(b))
141 #define MIN(a,b) (((a)<(b))?(a):(b))
142 #define MAX(a,b) (((a)>(b))?(a):(b))
143 #define ABS(x) (((x)>K(0.0))?(x):(-(x)))
144 #define SIGN(a) (((a)>=0)?1:-1)
145 #define SIGN(a) (((a)>=0)?1:-1)
146 #define SIGNF(a) IF((a)<K(0.0),K(-1.0),K(1.0))
149 #define SIZE(x) sizeof(x)/sizeof(x[0])
152 #define CSWAP(x,y) {C* NFFT_SWAP_temp__; \
153 NFFT_SWAP_temp__=(x); (x)=(y); (y)=NFFT_SWAP_temp__;}
156 #define RSWAP(x,y) {R* NFFT_SWAP_temp__; NFFT_SWAP_temp__=(x); \
157 (x)=(y); (y)=NFFT_SWAP_temp__;}
161 #if defined(DIRAC_DELTA)
162 #define PHI_HUT(n,k,d) K(1.0)
163 #define PHI(n,x,d) IF(FABS((x)) < K(10E-8),K(1.0),K(0.0))
164 #define WINDOW_HELP_INIT(d)
165 #define WINDOW_HELP_FINALIZE
166 #define WINDOW_HELP_ESTIMATE_m 0
167 #elif defined(GAUSSIAN)
168 #define PHI_HUT(n,k,d) ((R)EXP(-(POW(KPI*(k)/n,K(2.0))*ths->b[d])))
169 #define PHI(n,x,d) ((R)EXP(-POW((x)*((R)n),K(2.0)) / \
170 ths->b[d])/SQRT(KPI*ths->b[d]))
171 #define WINDOW_HELP_INIT \
174 ths->b = (R*) Y(malloc)(ths->d*sizeof(R)); \
175 for (WINDOW_idx = 0; WINDOW_idx < ths->d; WINDOW_idx++) \
176 ths->b[WINDOW_idx]=(K(2.0)*ths->sigma[WINDOW_idx]) / \
177 (K(2.0)*ths->sigma[WINDOW_idx] - K(1.0)) * (((R)ths->m) / KPI); \
179 #define WINDOW_HELP_FINALIZE {Y(free)(ths->b);}
180 #if defined(NFFT_LDOUBLE)
181 #define WINDOW_HELP_ESTIMATE_m 17
182 #elif defined(NFFT_SINGLE)
183 #define WINDOW_HELP_ESTIMATE_m 5
185 #define WINDOW_HELP_ESTIMATE_m 13
187 #elif defined(B_SPLINE)
188 #define PHI_HUT(n,k,d) ((R)(((k) == 0) ? K(1.0) / n : \
189 POW(SIN((k) * KPI / n) / ((k) * KPI / n), \
191 #define PHI(n,x,d) (Y(bspline)(2*ths->m,((x)*n) + \
192 (R)ths->m,ths->spline_coeffs) / n)
193 #define WINDOW_HELP_INIT \
195 ths->spline_coeffs= (R*)Y(malloc)(2*ths->m*sizeof(R)); \
197 #define WINDOW_HELP_FINALIZE {Y(free)(ths->spline_coeffs);}
198 #if defined(NFFT_LDOUBLE)
199 #define WINDOW_HELP_ESTIMATE_m 11
200 #elif defined(NFFT_SINGLE)
201 #define WINDOW_HELP_ESTIMATE_m 11
203 #define WINDOW_HELP_ESTIMATE_m 11
205 #elif defined(SINC_POWER)
206 #define PHI_HUT(n,k,d) (Y(bspline)(2 * ths->m, (K(2.0) * ths->m*(k)) / \
207 ((K(2.0) * ths->sigma[(d)] - 1) * n / \
208 ths->sigma[(d)]) + (R)ths->m, ths->spline_coeffs))
209 #define PHI(n,x,d) ((R)(n / ths->sigma[(d)] * \
210 (K(2.0) * ths->sigma[(d)] - K(1.0))/ (K(2.0)*ths->m) * \
211 POW(Y(sinc)(KPI * n / ths->sigma[(d)] * (x) * \
212 (K(2.0) * ths->sigma[(d)] - K(1.0)) / (K(2.0)*ths->m)) , 2*ths->m) / \
214 #define WINDOW_HELP_INIT \
216 ths->spline_coeffs= (R*)Y(malloc)(2 * ths->m * sizeof(R)); \
218 #define WINDOW_HELP_FINALIZE {Y(free)(ths->spline_coeffs);}
219 #if defined(NFFT_LDOUBLE)
220 #define WINDOW_HELP_ESTIMATE_m 13
221 #elif defined(NFFT_SINGLE)
222 #define WINDOW_HELP_ESTIMATE_m 11
224 #define WINDOW_HELP_ESTIMATE_m 11
227 #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)))))
228 #define PHI(n,x,d) ( (((R)(ths->m) * (R)(ths->m) - (x) * (R)(n) * (x) * (R)(n)) > K(0.0)) \
229 ? SINH(ths->b[d] * SQRT((R)(ths->m) * (R)(ths->m) - (x) * (R)(n) * (x) * (R)(n))) \
230 / (KPI * SQRT((R)(ths->m) * (R)(ths->m) - (x) * (R)(n) * (x) * (R)(n))) \
231 : ((((R)(ths->m) * (R)(ths->m) - (x) * (R)(n) * (x) * (R)(n)) < K(0.0)) \
232 ? SIN(ths->b[d] * SQRT((x) * (R)(n) * (x) * (R)(n) - (R)(ths->m) * (R)(ths->m))) \
233 / (KPI * SQRT((x) * (R)(n) * (x) * (R)(n) - (R)(ths->m) * (R)(ths->m))) \
235 #define WINDOW_HELP_INIT \
238 ths->b = (R*) Y(malloc)((size_t)(ths->d) * sizeof(R)); \
239 for (WINDOW_idx = 0; WINDOW_idx < ths->d; WINDOW_idx++) \
240 ths->b[WINDOW_idx] = (KPI * (K(2.0) - K(1.0) / ths->sigma[WINDOW_idx])); \
242 #define WINDOW_HELP_FINALIZE {Y(free)(ths->b);}
243 #if defined(NFFT_LDOUBLE)
244 #define WINDOW_HELP_ESTIMATE_m 9
245 #elif defined(NFFT_SINGLE)
246 #define WINDOW_HELP_ESTIMATE_m 4
248 #define WINDOW_HELP_ESTIMATE_m 8
253 INT Y(m2K)(
const INT m);
255 #if defined(NFFT_LDOUBLE)
256 #if HAVE_DECL_COPYSIGNL == 0
257 extern long double copysignl(
long double,
long double);
259 #if HAVE_DECL_NEXTAFTERL == 0
260 extern long double nextafterl(
long double,
long double);
262 #if HAVE_DECL_NANL == 0
263 extern long double nanl(
const char *tag);
265 #if HAVE_DECL_CEILL == 0
266 extern long double ceill(
long double);
268 #if HAVE_DECL_FLOORL == 0
269 extern long double floorl(
long double);
271 #if HAVE_DECL_NEARBYINTL == 0
272 extern long double nearbyintl(
long double);
274 #if HAVE_DECL_RINTL == 0
275 extern long double rintl(
long double);
277 #if HAVE_DECL_ROUNDL == 0
278 extern long double roundl(
long double);
280 #if HAVE_DECL_LRINTL == 0
281 extern long int lrintl(
long double);
283 #if HAVE_DECL_LROUNDL == 0
284 extern long int lroundl(
long double);
286 #if HAVE_DECL_LLRINTL == 0
287 extern long long int llrintl(
long double);
289 #if HAVE_DECL_LLROUNDL == 0
290 extern long long int llroundl(
long double);
292 #if HAVE_DECL_TRUNCL == 0
293 extern long double truncl(
long double);
295 #if HAVE_DECL_FMODL == 0
296 extern long double fmodl(
long double,
long double);
298 #if HAVE_DECL_REMAINDERL == 0
299 extern long double remainderl(
long double,
long double);
301 #if HAVE_DECL_REMQUOL == 0
302 extern long double remquol(
long double x,
long double y,
int *);
304 #if HAVE_DECL_FDIML == 0
305 extern long double fdiml(
long double,
long double);
307 #if HAVE_DECL_FMAXL == 0
308 extern long double fmaxl(
long double,
long double);
310 #if HAVE_DECL_FMINL == 0
311 extern long double fminl(
long double,
long double);
313 #if HAVE_DECL_FMAL == 0
314 extern long double fmal(
long double x,
long double y,
long double z);
316 #if HAVE_DECL_FABSL == 0
317 extern long double fabsl(
long double);
319 #if HAVE_DECL_SQRTL == 0
320 extern long double sqrtl(
long double);
322 #if HAVE_DECL_CBRTL == 0
323 extern long double cbrtl(
long double);
325 #if HAVE_DECL_HYPOTL == 0
326 extern long double hypotl(
long double,
long double);
328 #if HAVE_DECL_EXPL == 0
329 extern long double expl(
long double);
331 #if HAVE_DECL_EXP2L == 0
332 extern long double exp2l(
long double);
334 #if HAVE_DECL_EXPM1L == 0
335 extern long double expm1l(
long double);
337 #if HAVE_DECL_LOGL == 0
338 extern long double logl(
long double);
340 #if HAVE_DECL_LOG2L == 0
341 extern long double log2l(
long double);
343 #if HAVE_DECL_LOG10L == 0
344 extern long double log10l(
long double);
346 #if HAVE_DECL_LOG1PL == 0
347 extern long double log1pl(
long double);
349 #if HAVE_DECL_LOGBL == 0
350 extern long double logbl(
long double);
352 #if HAVE_DECL_ILOGBL == 0
353 extern int ilogbl(
long double);
355 #if HAVE_DECL_MODFL == 0
356 extern long double modfl(
long double,
long double *);
358 #if HAVE_DECL_FREXPL == 0
359 extern long double frexpl(
long double,
int *);
361 #if HAVE_DECL_LDEXPL == 0
362 extern long double ldexpl(
long double,
int);
364 #if HAVE_DECL_SCALBNL == 0
365 extern long double scalbnl(
long double,
int);
367 #if HAVE_DECL_SCALBLNL == 0
368 extern long double scalblnl(
long double,
long int);
370 #if HAVE_DECL_POWL == 0
371 extern long double powl(
long double,
long double);
373 #if HAVE_DECL_COSL == 0
374 extern long double cosl(
long double);
376 #if HAVE_DECL_SINL == 0
377 extern long double sinl(
long double);
379 #if HAVE_DECL_TANL == 0
380 extern long double tanl(
long double);
382 #if HAVE_DECL_COSHL == 0
383 extern long double coshl(
long double);
385 #if HAVE_DECL_SINHL == 0
386 extern long double sinhl(
long double);
388 #if HAVE_DECL_TANHL == 0
389 extern long double tanhl(
long double);
391 #if HAVE_DECL_ACOSL == 0
392 extern long double acosl(
long double);
394 #if HAVE_DECL_ASINL == 0
395 extern long double asinl(
long double);
397 #if HAVE_DECL_ATANL == 0
398 extern long double atanl(
long double);
400 #if HAVE_DECL_ATAN2L == 0
401 extern long double atan2l(
long double,
long double);
403 #if HAVE_DECL_ACOSHL == 0
404 extern long double acoshl(
long double);
406 #if HAVE_DECL_ASINHL == 0
407 extern long double asinhl(
long double);
409 #if HAVE_DECL_ATANHL == 0
410 extern long double atanhl(
long double);
412 #if HAVE_DECL_TGAMMAL == 0
413 extern long double tgammal(
long double);
415 #if HAVE_DECL_LGAMMAL == 0
416 extern long double lgammal(
long double);
418 #if HAVE_DECL_J0L == 0
419 extern long double j0l(
long double);
421 #if HAVE_DECL_J1L == 0
422 extern long double j1l(
long double);
424 #if HAVE_DECL_JNL == 0
425 extern long double jnl(
int,
long double);
427 #if HAVE_DECL_Y0L == 0
428 extern long double y0l(
long double);
430 #if HAVE_DECL_Y1L == 0
431 extern long double y1l(
long double);
433 #if HAVE_DECL_YNL == 0
434 extern long double ynl(
int,
long double);
436 #if HAVE_DECL_ERFL == 0
437 extern long double erfl(
long double);
439 #if HAVE_DECL_ERFCL == 0
440 extern long double erfcl(
long double);
442 #if HAVE_DECL_CREALL == 0
443 extern long double creall(
long double _Complex z);
445 #if HAVE_DECL_CIMAGL == 0
446 extern long double cimagl(
long double _Complex z);
448 #if HAVE_DECL_CABSL == 0
449 extern long double cabsl(
long double _Complex z);
451 #if HAVE_DECL_CARGL == 0
452 extern long double cargl(
long double _Complex z);
454 #if HAVE_DECL_CONJL == 0
455 extern long double _Complex conjl(
long double _Complex z);
457 #if HAVE_DECL_CPROJL == 0
458 extern long double _Complex cprojl(
long double _Complex z);
460 #if HAVE_DECL_CSQRTL == 0
461 extern long double _Complex csqrtl(
long double _Complex z);
463 #if HAVE_DECL_CEXPL == 0
464 extern long double _Complex cexpl(
long double _Complex z);
466 #if HAVE_DECL_CLOGL == 0
467 extern long double _Complex clogl(
long double _Complex z);
469 #if HAVE_DECL_CPOWL == 0
470 extern long double _Complex cpowl(
long double _Complex z,
long double _Complex w);
472 #if HAVE_DECL_CSINL == 0
473 extern long double _Complex csinl(
long double _Complex z);
475 #if HAVE_DECL_CCOSL == 0
476 extern long double _Complex ccosl(
long double _Complex z);
478 #if HAVE_DECL_CTANL == 0
479 extern long double _Complex ctanl(
long double _Complex z);
481 #if HAVE_DECL_CASINL == 0
482 extern long double _Complex casinl(
long double _Complex z);
484 #if HAVE_DECL_CACOSL == 0
485 extern long double _Complex cacosl(
long double _Complex z);
487 #if HAVE_DECL_CATANL == 0
488 extern long double _Complex catanl(
long double _Complex z);
490 #if HAVE_DECL_CSINHL == 0
491 extern long double _Complex csinhl(
long double _Complex z);
493 #if HAVE_DECL_CCOSHL == 0
494 extern long double _Complex ccoshl(
long double _Complex z);
496 #if HAVE_DECL_CTANHL == 0
497 extern long double _Complex ctanhl(
long double _Complex z);
499 #if HAVE_DECL_CASINHL == 0
500 extern long double _Complex casinhl(
long double _Complex z);
502 #if HAVE_DECL_CACOSHL == 0
503 extern long double _Complex cacoshl(
long double _Complex z);
505 #if HAVE_DECL_CATANHL == 0
506 extern long double _Complex catanhl(
long double _Complex z);
508 #define COPYSIGN copysignl
509 #define NEXTAFTER nextafterl
513 #define NEARBYINT nearbyintl
517 #define LROUND lroundl
518 #define LLRINT llrintl
519 #define LLROUND llroundl
522 #define REMAINDER remainderl
523 #define REMQUO remquol
544 #define SCALBN scalbnl
545 #define SCALBLN scalblnl
560 #define TGAMMA tgammal
561 #define LGAMMA lgammal
589 #define CASINH casinhl
590 #define CACOSH cacoshl
591 #define CATANH catanhl
592 #elif defined(NFFT_SINGLE)
593 #if HAVE_DECL_COPYSIGNF == 0
594 extern float copysignf(
float,
float);
596 #if HAVE_DECL_NEXTAFTERF == 0
597 extern float nextafterf(
float,
float);
599 #if HAVE_DECL_NANF == 0
600 extern float nanf(
const char *tag);
602 #if HAVE_DECL_CEILF == 0
603 extern float ceilf(
float);
605 #if HAVE_DECL_FLOORF == 0
606 extern float floorf(
float);
608 #if HAVE_DECL_NEARBYINTF == 0
609 extern float nearbyintf(
float);
611 #if HAVE_DECL_RINTF == 0
612 extern float rintf(
float);
614 #if HAVE_DECL_ROUNDF == 0
615 extern float roundf(
float);
617 #if HAVE_DECL_LRINTF == 0
618 extern long int lrintf(
float);
620 #if HAVE_DECL_LROUNDF == 0
621 extern long int lroundf(
float);
623 #if HAVE_DECL_LLRINTF == 0
624 extern long long int llrintf(
float);
626 #if HAVE_DECL_LLROUNDF == 0
627 extern long long int llroundf(
float);
629 #if HAVE_DECL_TRUNCF == 0
630 extern float truncf(
float);
632 #if HAVE_DECL_FMODF == 0
633 extern float fmodf(
float,
float);
635 #if HAVE_DECL_REMAINDERF == 0
636 extern float remainderf(
float,
float);
638 #if HAVE_DECL_REMQUOF == 0
639 extern float remquof(
float x,
float y,
int *);
641 #if HAVE_DECL_FDIMF == 0
642 extern float fdimf(
float,
float);
644 #if HAVE_DECL_FMAXF == 0
645 extern float fmaxf(
float,
float);
647 #if HAVE_DECL_FMINF == 0
648 extern float fminf(
float,
float);
650 #if HAVE_DECL_FMAF == 0
651 extern float fmaf(
float x,
float y,
float z);
653 #if HAVE_DECL_FABSF == 0
654 extern float fabsf(
float);
656 #if HAVE_DECL_SQRTF == 0
657 extern float sqrtf(
float);
659 #if HAVE_DECL_CBRTF == 0
660 extern float cbrtf(
float);
662 #if HAVE_DECL_HYPOTF == 0
663 extern float hypotf(
float,
float);
665 #if HAVE_DECL_EXPF == 0
666 extern float expf(
float);
668 #if HAVE_DECL_EXP2F == 0
669 extern float exp2f(
float);
671 #if HAVE_DECL_EXPM1F == 0
672 extern float expm1f(
float);
674 #if HAVE_DECL_LOGF == 0
675 extern float logf(
float);
677 #if HAVE_DECL_LOG2F == 0
678 extern float log2f(
float);
680 #if HAVE_DECL_LOG10F == 0
681 extern float log10f(
float);
683 #if HAVE_DECL_LOG1PF == 0
684 extern float log1pf(
float);
686 #if HAVE_DECL_LOGBF == 0
687 extern float logbf(
float);
689 #if HAVE_DECL_ILOGBF == 0
690 extern int ilogbf(
float);
692 #if HAVE_DECL_MODFF == 0
693 extern float modff(
float,
float *);
695 #if HAVE_DECL_FREXPF == 0
696 extern float frexpf(
float,
int *);
698 #if HAVE_DECL_LDEXPF == 0
699 extern float ldexpf(
float,
int);
701 #if HAVE_DECL_SCALBNF == 0
702 extern float scalbnf(
float,
int);
704 #if HAVE_DECL_SCALBLNF == 0
705 extern float scalblnf(
float,
long int);
707 #if HAVE_DECL_POWF == 0
708 extern float powf(
float,
float);
710 #if HAVE_DECL_COSF == 0
711 extern float cosf(
float);
713 #if HAVE_DECL_SINF == 0
714 extern float sinf(
float);
716 #if HAVE_DECL_TANF == 0
717 extern float tanf(
float);
719 #if HAVE_DECL_COSHF == 0
720 extern float coshf(
float);
722 #if HAVE_DECL_SINHF == 0
723 extern float sinhf(
float);
725 #if HAVE_DECL_TANHF == 0
726 extern float tanhf(
float);
728 #if HAVE_DECL_ACOSF == 0
729 extern float acosf(
float);
731 #if HAVE_DECL_ASINF == 0
732 extern float asinf(
float);
734 #if HAVE_DECL_ATANF == 0
735 extern float atanf(
float);
737 #if HAVE_DECL_ATAN2F == 0
738 extern float atan2f(
float,
float);
740 #if HAVE_DECL_ACOSHF == 0
741 extern float acoshf(
float);
743 #if HAVE_DECL_ASINHF == 0
744 extern float asinhf(
float);
746 #if HAVE_DECL_ATANHF == 0
747 extern float atanhf(
float);
749 #if HAVE_DECL_TGAMMAF == 0
750 extern float tgammaf(
float);
752 #if HAVE_DECL_LGAMMAF == 0
753 extern float lgammaf(
float);
755 #if HAVE_DECL_J0F == 0
756 extern float j0f(
float);
758 #if HAVE_DECL_J1F == 0
759 extern float j1f(
float);
761 #if HAVE_DECL_JNF == 0
762 extern float jnf(
int,
float);
764 #if HAVE_DECL_Y0F == 0
765 extern float y0f(
float);
767 #if HAVE_DECL_Y1F == 0
768 extern float y1f(
float);
770 #if HAVE_DECL_YNF == 0
771 extern float ynf(
int,
float);
773 #if HAVE_DECL_ERFF == 0
774 extern float erff(
float);
776 #if HAVE_DECL_ERFCF == 0
777 extern float erfcf(
float);
779 #if HAVE_DECL_CREALF == 0
780 extern float crealf(
float _Complex z);
782 #if HAVE_DECL_CIMAGF == 0
783 extern float cimagf(
float _Complex z);
785 #if HAVE_DECL_CABSF == 0
786 extern float cabsf(
float _Complex z);
788 #if HAVE_DECL_CARGF == 0
789 extern float cargf(
float _Complex z);
791 #if HAVE_DECL_CONJF == 0
792 extern float _Complex conjf(
float _Complex z);
794 #if HAVE_DECL_CPROJF == 0
795 extern float _Complex cprojf(
float _Complex z);
797 #if HAVE_DECL_CSQRTF == 0
798 extern float _Complex csqrtf(
float _Complex z);
800 #if HAVE_DECL_CEXPF == 0
801 extern float _Complex cexpf(
float _Complex z);
803 #if HAVE_DECL_CLOGF == 0
804 extern float _Complex clogf(
float _Complex z);
806 #if HAVE_DECL_CPOWF == 0
807 extern float _Complex cpowf(
float _Complex z,
float _Complex w);
809 #if HAVE_DECL_CSINF == 0
810 extern float _Complex csinf(
float _Complex z);
812 #if HAVE_DECL_CCOSF == 0
813 extern float _Complex ccosf(
float _Complex z);
815 #if HAVE_DECL_CTANF == 0
816 extern float _Complex ctanf(
float _Complex z);
818 #if HAVE_DECL_CASINF == 0
819 extern float _Complex casinf(
float _Complex z);
821 #if HAVE_DECL_CACOSF == 0
822 extern float _Complex cacosf(
float _Complex z);
824 #if HAVE_DECL_CATANF == 0
825 extern float _Complex catanf(
float _Complex z);
827 #if HAVE_DECL_CSINHF == 0
828 extern float _Complex csinhf(
float _Complex z);
830 #if HAVE_DECL_CCOSHF == 0
831 extern float _Complex ccoshf(
float _Complex z);
833 #if HAVE_DECL_CTANHF == 0
834 extern float _Complex ctanhf(
float _Complex z);
836 #if HAVE_DECL_CASINHF == 0
837 extern float _Complex casinhf(
float _Complex z);
839 #if HAVE_DECL_CACOSHF == 0
840 extern float _Complex cacoshf(
float _Complex z);
842 #if HAVE_DECL_CATANHF == 0
843 extern float _Complex catanhf(
float _Complex z);
845 #define COPYSIGN copysignf
846 #define NEXTAFTER nextafterf
850 #define NEARBYINT nearbyintf
854 #define LROUND lroundf
855 #define LLRINT llrintf
856 #define LLROUND llroundf
859 #define REMAINDER remainderf
860 #define REMQUO remquof
881 #define SCALBN scalbnf
882 #define SCALBLN scalblnf
897 #define TGAMMA tgammaf
898 #define LGAMMA lgammaf
926 #define CASINH casinhf
927 #define CACOSH cacoshf
928 #define CATANH catanhf
930 #if HAVE_DECL_COPYSIGN == 0
931 extern double copysign(
double,
double);
933 #if HAVE_DECL_NEXTAFTER == 0
934 extern double nextafter(
double,
double);
936 #if HAVE_DECL_NAN == 0
937 extern double nan(
const char *tag);
939 #if HAVE_DECL_CEIL == 0
940 extern double ceil(
double);
942 #if HAVE_DECL_FLOOR == 0
943 extern double floor(
double);
945 #if HAVE_DECL_NEARBYINT == 0
946 extern double nearbyint(
double);
948 #if HAVE_DECL_RINT == 0
949 extern double rint(
double);
951 #if HAVE_DECL_ROUND == 0
952 extern double round(
double);
954 #if HAVE_DECL_LRINT == 0
955 extern long int lrint(
double);
957 #if HAVE_DECL_LROUND == 0
958 extern long int lround(
double);
960 #if HAVE_DECL_LLRINT == 0
961 extern long long int llrint(
double);
963 #if HAVE_DECL_LLROUND == 0
964 extern long long int llround(
double);
966 #if HAVE_DECL_TRUNC == 0
967 extern double trunc(
double);
969 #if HAVE_DECL_FMOD == 0
970 extern double fmod(
double,
double);
972 #if HAVE_DECL_REMAINDER == 0
973 extern double remainder(
double,
double);
975 #if HAVE_DECL_REMQUO == 0
976 extern double remquo(
double x,
double y,
int *);
978 #if HAVE_DECL_FDIM == 0
979 extern double fdim(
double,
double);
981 #if HAVE_DECL_FMAX == 0
982 extern double fmax(
double,
double);
984 #if HAVE_DECL_FMIN == 0
985 extern double fmin(
double,
double);
987 #if HAVE_DECL_FMA == 0
988 extern double fma(
double x,
double y,
double z);
990 #if HAVE_DECL_FABS == 0
991 extern double fabs(
double);
993 #if HAVE_DECL_SQRT == 0
994 extern double sqrt(
double);
996 #if HAVE_DECL_CBRT == 0
997 extern double cbrt(
double);
999 #if HAVE_DECL_HYPOT == 0
1000 extern double hypot(
double,
double);
1002 #if HAVE_DECL_EXP == 0
1003 extern double exp(
double);
1005 #if HAVE_DECL_EXP2 == 0
1006 extern double exp2(
double);
1008 #if HAVE_DECL_EXPM1 == 0
1009 extern double expm1(
double);
1011 #if HAVE_DECL_LOG == 0
1012 extern double log(
double);
1014 #if HAVE_DECL_LOG2 == 0
1015 extern double log2(
double);
1017 #if HAVE_DECL_LOG10 == 0
1018 extern double log10(
double);
1020 #if HAVE_DECL_LOG1P == 0
1021 extern double log1p(
double);
1023 #if HAVE_DECL_LOGB == 0
1024 extern double logb(
double);
1026 #if HAVE_DECL_ILOGB == 0
1027 extern int ilogb(
double);
1029 #if HAVE_DECL_MODF == 0
1030 extern double modf(
double,
double *);
1032 #if HAVE_DECL_FREXP == 0
1033 extern double frexp(
double,
int *);
1035 #if HAVE_DECL_LDEXP == 0
1036 extern double ldexp(
double,
int);
1038 #if HAVE_DECL_SCALBN == 0
1039 extern double scalbn(
double,
int);
1041 #if HAVE_DECL_SCALBLN == 0
1042 extern double scalbln(
double,
long int);
1044 #if HAVE_DECL_POW == 0
1045 extern double pow(
double,
double);
1047 #if HAVE_DECL_COS == 0
1048 extern double cos(
double);
1050 #if HAVE_DECL_SIN == 0
1051 extern double sin(
double);
1053 #if HAVE_DECL_TAN == 0
1054 extern double tan(
double);
1056 #if HAVE_DECL_COSH == 0
1057 extern double cosh(
double);
1059 #if HAVE_DECL_SINH == 0
1060 extern double sinh(
double);
1062 #if HAVE_DECL_TANH == 0
1063 extern double tanh(
double);
1065 #if HAVE_DECL_ACOS == 0
1066 extern double acos(
double);
1068 #if HAVE_DECL_ASIN == 0
1069 extern double asin(
double);
1071 #if HAVE_DECL_ATAN == 0
1072 extern double atan(
double);
1074 #if HAVE_DECL_ATAN2 == 0
1075 extern double atan2(
double,
double);
1077 #if HAVE_DECL_ACOSH == 0
1078 extern double acosh(
double);
1080 #if HAVE_DECL_ASINH == 0
1081 extern double asinh(
double);
1083 #if HAVE_DECL_ATANH == 0
1084 extern double atanh(
double);
1086 #if HAVE_DECL_TGAMMA == 0
1087 extern double tgamma(
double);
1089 #if HAVE_DECL_LGAMMA == 0
1090 extern double lgamma(
double);
1092 #if HAVE_DECL_J0 == 0
1093 extern double j0(
double);
1095 #if HAVE_DECL_J1 == 0
1096 extern double j1(
double);
1098 #if HAVE_DECL_JN == 0
1099 extern double jn(
int,
double);
1101 #if HAVE_DECL_Y0 == 0
1102 extern double y0(
double);
1104 #if HAVE_DECL_Y1 == 0
1105 extern double y1(
double);
1107 #if HAVE_DECL_YN == 0
1108 extern double yn(
int,
double);
1110 #if HAVE_DECL_ERF == 0
1111 extern double erf(
double);
1113 #if HAVE_DECL_ERFC == 0
1114 extern double erfc(
double);
1116 #if HAVE_DECL_CREAL == 0
1117 extern double creal(
double _Complex z);
1119 #if HAVE_DECL_CIMAG == 0
1120 extern double cimag(
double _Complex z);
1122 #if HAVE_DECL_CABS == 0
1123 extern double cabs(
double _Complex z);
1125 #if HAVE_DECL_CARG == 0
1126 extern double carg(
double _Complex z);
1128 #if HAVE_DECL_CONJ == 0
1129 extern double _Complex conj(
double _Complex z);
1131 #if HAVE_DECL_CPROJ == 0
1132 extern double _Complex cproj(
double _Complex z);
1134 #if HAVE_DECL_CSQRT == 0
1135 extern double _Complex csqrt(
double _Complex z);
1137 #if HAVE_DECL_CEXP == 0
1138 extern double _Complex cexp(
double _Complex z);
1140 #if HAVE_DECL_CLOG == 0
1141 extern double _Complex clog(
double _Complex z);
1143 #if HAVE_DECL_CPOW == 0
1144 extern double _Complex cpow(
double _Complex z,
double _Complex w);
1146 #if HAVE_DECL_CSIN == 0
1147 extern double _Complex csin(
double _Complex z);
1149 #if HAVE_DECL_CCOS == 0
1150 extern double _Complex ccos(
double _Complex z);
1152 #if HAVE_DECL_CTAN == 0
1153 extern double _Complex ctan(
double _Complex z);
1155 #if HAVE_DECL_CASIN == 0
1156 extern double _Complex casin(
double _Complex z);
1158 #if HAVE_DECL_CACOS == 0
1159 extern double _Complex cacos(
double _Complex z);
1161 #if HAVE_DECL_CATAN == 0
1162 extern double _Complex catan(
double _Complex z);
1164 #if HAVE_DECL_CSINH == 0
1165 extern double _Complex csinh(
double _Complex z);
1167 #if HAVE_DECL_CCOSH == 0
1168 extern double _Complex ccosh(
double _Complex z);
1170 #if HAVE_DECL_CTANH == 0
1171 extern double _Complex ctanh(
double _Complex z);
1173 #if HAVE_DECL_CASINH == 0
1174 extern double _Complex casinh(
double _Complex z);
1176 #if HAVE_DECL_CACOSH == 0
1177 extern double _Complex cacosh(
double _Complex z);
1179 #if HAVE_DECL_CATANH == 0
1180 extern double _Complex catanh(
double _Complex z);
1182 #define COPYSIGN copysign
1183 #define NEXTAFTER nextafter
1187 #define NEARBYINT nearbyint
1191 #define LROUND lround
1192 #define LLRINT llrint
1193 #define LLROUND llround
1196 #define REMAINDER remainder
1197 #define REMQUO remquo
1218 #define SCALBN scalbn
1219 #define SCALBLN scalbln
1234 #define TGAMMA tgamma
1235 #define LGAMMA lgamma
1263 #define CASINH casinh
1264 #define CACOSH cacosh
1265 #define CATANH catanh
1268 #if defined(NFFT_LDOUBLE)
1269 #define EPSILON LDBL_EPSILON//4.0E-31L
1270 #define MANT_DIG LDBL_MANT_DIG
1271 #define MIN_EXP LDBL_MIN_EXP
1272 #define MAX_EXP LDBL_MAX_EXP
1273 #elif defined(NFFT_SINGLE)
1274 #define EPSILON FLT_EPSILON
1275 #define MANT_DIG FLT_MANT_DIG
1276 #define MIN_EXP FLT_MIN_EXP
1277 #define MAX_EXP FLT_MAX_EXP
1279 #define EPSILON DBL_EPSILON
1280 #define MANT_DIG DBL_MANT_DIG
1281 #define MIN_EXP DBL_MIN_EXP
1282 #define MAX_EXP DBL_MAX_EXP
1285 #if defined(FLT_ROUND)
1287 #define FLTROUND 1.0
1289 #define FLTROUND 0.0
1292 #define FLTROUND 0.0
1295 #if HAVE_DECL_DRAND48 == 0
1296 extern double drand48(
void);
1298 #if HAVE_DECL_SRAND48 == 0
1299 extern void srand48(
long int);
1301 #define R_RADIX FLT_RADIX
1302 #define II _Complex_I
1305 #if defined(NFFT_LDOUBLE)
1306 # define __FGS__ "Lg"
1307 # define __FES__ "LE"
1308 # define __FE__ "% 36.32LE"
1309 # define __FI__ "%Lf"
1310 # define __FIS__ "Lf"
1311 # define __FR__ "%La"
1312 #elif defined(NFFT_SINGLE)
1313 # define __FGS__ "g"
1314 # define __FES__ "E"
1315 # define __FE__ "% 12.8E"
1316 # define __FI__ "%f"
1317 # define __FIS__ "f"
1318 # define __FR__ "%a"
1320 # define __FGS__ "lg"
1321 # define __FES__ "lE"
1322 # define __FE__ "% 20.16lE"
1323 # define __FI__ "%lf"
1324 # define __FIS__ "lf"
1325 # define __FR__ "%la"
1334 #define UNUSED(x) (void)x
1341 #define alloca __builtin_alloca
1348 #define alloca _alloca
1362 void *alloca(
size_t);
1370 #define STACK_MALLOC(T, p, x) p = (T)alloca(x)
1371 #define STACK_FREE(x)
1375 #define STACK_MALLOC(T, p, x) p = (T)Y(malloc)(x)
1376 #define STACK_FREE(x) Y(free)(x)
1380 R Y(elapsed_seconds)(ticks t1, ticks t0);
1383 #define UNUSED(x) (void)x
1393 double MEASURE_TIME_tt;
1394 ticks MEASURE_TIME_t0, MEASURE_TIME_t1;
1397 ths->MEASURE_TIME_t[(a)]=0; \
1403 MEASURE_TIME_t0 = getticks(); \
1408 MEASURE_TIME_t1 = getticks(); \
1409 MEASURE_TIME_tt = Y(elapsed_seconds)(MEASURE_TIME_t1,MEASURE_TIME_t0);\
1410 ths->MEASURE_TIME_t[(a)]+=MEASURE_TIME_tt; \
1412 ths->MEASURE_TIME_t[(a)]/=MEASURE_TIME_r; \
1419 #ifdef MEASURE_TIME_FFTW
1420 #define TIC_FFTW(a) TIC(a)
1421 #define TOC_FFTW(a) TOC(a)
1435 R Y(lambda)(R z, R eps);
1438 R Y(lambda2)(R mu, R nu);
1441 R Y(bessel_i0)(R x);
1444 R Y(bspline)(
const INT,
const R x, R*);
1447 typedef enum {NFFT_EPSILON = 0, NFFT_SAFE__MIN = 1, NFFT_BASE = 2,
1448 NFFT_PRECISION = 3, NFFT_MANT_DIG = 4, NFFT_FLTROUND = 5, NFFT_E_MIN = 6,
1449 NFFT_R_MIN = 7, NFFT_E_MAX = 8, NFFT_R_MAX = 9} float_property;
1451 R Y(float_property)(float_property);
1452 R Y(prod_real)(R *vec, INT d);
1455 INT Y(log2i)(
const INT m);
1456 void Y(next_power_of_2_exp)(
const INT N, INT *N2, INT *t);
1459 R Y(error_l_infty_double)(
const R *x,
const R *y,
const INT n);
1460 R Y(error_l_infty_1_double)(
const R *x,
const R *y,
const INT n,
const R *z,
1462 R Y(error_l_2_complex)(
const C *x,
const C *y,
const INT n);
1463 R Y(error_l_2_double)(
const R *x,
const R *y,
const INT n);
1466 void Y(sort_node_indices_radix_msdf)(INT n, INT *keys0, INT *keys1, INT rhigh);
1467 void Y(sort_node_indices_radix_lsdf)(INT n, INT *keys0, INT *keys1, INT rhigh);
1470 void Y(assertion_failed)(
const char *s,
int line,
const char *file);
1474 R Y(dot_double)(R *x, INT n);
1476 R Y(dot_w_complex)(C *x, R *w, INT n);
1478 R Y(dot_w_double)(R *x, R *w, INT n);
1480 R Y(dot_w_w2_complex)(C *x, R *w, R *w2, INT n);
1482 R Y(dot_w2_complex)(C *x, R *w2, INT n);
1486 void Y(cp_complex)(C *x, C *y, INT n);
1488 void Y(cp_double)(R *x, R *y, INT n);
1490 void Y(cp_a_complex)(C *x, R a, C *y, INT n);
1492 void Y(cp_a_double)(R *x, R a, R *y, INT n);
1494 void Y(cp_w_complex)(C *x, R *w, C *y, INT n);
1496 void Y(cp_w_double)(R *x, R *w, R *y, INT n);
1500 void Y(upd_axpy_double)(R *x, R a, R *y, INT n);
1502 void Y(upd_xpay_complex)(C *x, R a, C *y, INT n);
1504 void Y(upd_xpay_double)(R *x, R a, R *y, INT n);
1506 void Y(upd_axpby_complex)(C *x, R a, C *y, R b, INT n);
1508 void Y(upd_axpby_double)(R *x, R a, R *y, R b, INT n);
1510 void Y(upd_xpawy_complex)(C *x, R a, R *w, C *y, INT n);
1512 void Y(upd_xpawy_double)(R *x, R a, R *w, R *y, INT n);
1514 void Y(upd_axpwy_complex)(C *x, R a, R *w, C *y, INT n);
1516 void Y(upd_axpwy_double)(R *x, R a, R *w, R *y, INT n);
1519 void Y(voronoi_weights_1d)(R *w, R *x,
const INT M);
1526 R Y(modified_fejer)(
const INT N,
const INT kk);
1528 R Y(modified_jackson2)(
const INT N,
const INT kk);
1530 R Y(modified_jackson4)(
const INT N,
const INT kk);
1532 R Y(modified_sobolev)(
const R mu,
const INT kk);
1534 R Y(modified_multiquadric)(
const R mu,
const R c,
const INT kk);
1538 (void)((ex) || (Y(assertion_failed)(#ex, __LINE__, __FILE__), 0))
1543 (void)((ex) || (Y(assertion_failed)(#ex, __LINE__, __FILE__), 0))