28 #define CSWAP(x,y) {double _Complex * NFFT_SWAP_temp__; \
29 NFFT_SWAP_temp__=(x); (x)=(y); (y)=NFFT_SWAP_temp__;}
31 static void accuracy_nsfft(
int d,
int J,
int M,
int m)
34 double _Complex *swap_sndft_trafo, *swap_sndft_adjoint;
38 swap_sndft_trafo=(
double _Complex*) nfft_malloc(p.M_total*
39 sizeof(
double _Complex));
40 swap_sndft_adjoint=(
double _Complex*) nfft_malloc(p.N_total*
41 sizeof(
double _Complex));
46 nsfft_trafo_direct(&p);
48 CSWAP(swap_sndft_trafo,p.f);
53 printf(
"%5d\t %+.5E\t",J,
54 nfft_error_l_infty_1_complex(swap_sndft_trafo, p.f, p.M_total,
58 nfft_vrand_unit_complex(p.f, p.M_total);
61 nsfft_adjoint_direct(&p);
63 CSWAP(swap_sndft_adjoint,p.f_hat);
69 nfft_error_l_infty_1_complex(swap_sndft_adjoint, p.f_hat,
74 nfft_free(swap_sndft_adjoint);
75 nfft_free(swap_sndft_trafo);
81 static void time_nsfft(
int d,
int J,
int M,
unsigned test_nsdft,
unsigned test_nfft)
84 double t, t_nsdft, t_nfft, t_nsfft;
92 N[r]= nfft_exp2i(J+2);
109 t0 = nfft_clock_gettime_seconds();
110 nsfft_trafo_direct(&p);
111 t1 = nfft_clock_gettime_seconds();
124 np.x=p.act_nfft_plan->x;
126 nfft_precompute_one_psi(&np);
134 t0 = nfft_clock_gettime_seconds();
136 t1 = nfft_clock_gettime_seconds();
154 t0 = nfft_clock_gettime_seconds();
156 t1 = nfft_clock_gettime_seconds();
162 printf(
"%d\t%.2e\t%.2e\t%.2e\n", J, t_nsdft, t_nfft, t_nsfft);
171 int main(
int argc,
char **argv)
177 fprintf(stderr,
"nsfft_test type d [first last trials]\n");
182 fprintf(stderr,
"Testing the nfft on the hyperbolic cross (nsfft).\n");
186 fprintf(stderr,
"Testing the accuracy of the nsfft vs. nsdft\n");
187 fprintf(stderr,
"Columns: d, E_{1,\\infty}(trafo) E_{1,\\infty}(adjoint)\n\n");
189 accuracy_nsfft(d, J, 1000, 6);
194 fprintf(stderr,
"Testing the computation time of the nsdft, nfft, and nsfft\n");
195 fprintf(stderr,
"Columns: d, J, M, t_nsdft, t_nfft, t_nsfft\n\n");
196 for(J=atoi(argv[3]); J<=atoi(argv[4]); J++)
199 M=(J+4)*nfft_exp2i(J+1);
201 M=6*nfft_exp2i(J)*(nfft_exp2i((J+1)/2+1)-1)+nfft_exp2i(3*(J/2+1));
204 time_nsfft(d, J, M, 1, 1);
207 time_nsfft(d, J, M, 0, 1);
209 time_nsfft(d, J, M, 0, 0);
#define CSWAP(x, y)
Swap two vectors.
void nsfft_init(nsfft_plan *ths, int d, int J, int M, int m, unsigned flags)
void nsfft_cp(nsfft_plan *ths, nfft_plan *ths_full_plan)
void nsfft_init_random_nodes_coeffs(nsfft_plan *ths)
void nsfft_adjoint(nsfft_plan *ths)
void nsfft_trafo(nsfft_plan *ths)
void nsfft_finalize(nsfft_plan *ths)
Header file for the nfft3 library.