34 static void accuracy_nsfft(
int d,
int J,
int M,
int m)
37 double _Complex *swap_sndft_trafo, *swap_sndft_adjoint;
39 nsfft_init(&p, d, J, M, m, NSDFT);
42 sizeof(
double _Complex));
44 sizeof(
double _Complex));
46 nsfft_init_random_nodes_coeffs(&p);
49 nsfft_trafo_direct(&p);
56 printf(
"%5d\t %+.5E\t",J,
57 X(error_l_infty_1_complex)(swap_sndft_trafo, p.
f, p.
M_total,
64 nsfft_adjoint_direct(&p);
72 X(error_l_infty_1_complex)(swap_sndft_adjoint, p.
f_hat,
84 static void time_nsfft(
int d,
int J,
int M,
unsigned test_nsdft,
unsigned test_nfft)
87 double t, t_nsdft, t_nfft, t_nsfft;
101 nsfft_init(&p, d, J, M, 4, NSDFT);
102 nsfft_init_random_nodes_coeffs(&p);
113 nsfft_trafo_direct(&p);
115 t = nfft_elapsed_seconds(t1,t0);
125 nfft_init_guru(&np,d,N,M,n,6, FG_PSI| MALLOC_F_HAT| MALLOC_F| FFTW_INIT,
129 nfft_precompute_one_psi(&np);
140 t = nfft_elapsed_seconds(t1,t0);
160 t = nfft_elapsed_seconds(t1,t0);
165 printf(
"%d\t%.2e\t%.2e\t%.2e\n", J, t_nsdft, t_nfft, t_nsfft);
174 int main(
int argc,
char **argv)
180 fprintf(stderr,
"nsfft_test type d [first last trials]\n");
185 fprintf(stderr,
"Testing the nfft on the hyperbolic cross (nsfft).\n");
189 fprintf(stderr,
"Testing the accuracy of the nsfft vs. nsdft\n");
190 fprintf(stderr,
"Columns: d, E_{1,\\infty}(trafo) E_{1,\\infty}(adjoint)\n\n");
192 accuracy_nsfft(d, J, 1000, 6);
197 fprintf(stderr,
"Testing the computation time of the nsdft, nfft, and nsfft\n");
198 fprintf(stderr,
"Columns: d, J, M, t_nsdft, t_nfft, t_nsfft\n\n");
199 for(J=atoi(argv[3]); J<=atoi(argv[4]); J++)
202 M=(J+4)*X(exp2i)(J+1);
204 M=6*X(exp2i)(J)*(X(exp2i)((J+1)/2+1)-1)+X(exp2i)(3*(J/2+1));
207 time_nsfft(d, J, M, 1, 1);
210 time_nsfft(d, J, M, 0, 1);
212 time_nsfft(d, J, M, 0, 0);