67 nfft_init_guru((
nfft_plan*)ths, 1, &N, M, &n, m,
68 MALLOC_X| MALLOC_F_HAT| MALLOC_F|
69 FFTW_INIT| FFT_OUT_OF_PLACE,
70 FFTW_ESTIMATE| FFTW_PRESERVE_INPUT);
91 ths->
idx0[j] = ((int)round((cths->
x[j]+0.5)*cths->
n[0]) +
92 cths->
n[0]/2)%cths->
n[0];
93 ths->
deltax0[j] = cths->
x[j] - (round((cths->
x[j]+0.5)*cths->
n[0]) /
126 double _Complex *f, *f_hat, *g1;
132 for(j=0, f=cths->
f; j<cths->M_total; j++)
139 f_hat=cths->
f_hat; k<0; k++)
140 (*g1++)=cpow( - 2*
PI*_Complex_I*k,cths->
m)* (*f_hat++);
145 k<cths->N_total/2; k++)
146 (*g1++)=cpow( - 2*
PI*_Complex_I*k,cths->
m)* (*f_hat++);
148 for(l=cths->
m-1; l>=0; l--)
152 (*g1++) /= (-2*
PI*_Complex_I*k);
154 for(k=1, g1=cths->
g1+1; k<cths->N_total/2; k++)
155 (*g1++) /= (-2*
PI*_Complex_I*k);
157 fftw_execute(cths->my_fftw_plan1);
160 for(j=0, f=cths->
f, deltax=ths->
deltax0, idx=ths->
idx0; j<cths->M_total;
162 (*f) = ((*f) * (*deltax++) + cths->
g2[*idx++]) /ll;
180 int m_taylor,
unsigned test_accuracy)
183 double t_ndft, t_nfft, t_taylor, t;
184 double _Complex *swapndft = NULL;
190 printf(
"%d\t%d\t",N, M);
194 nfft_init_guru(&np, 1, &N, M, &n, m,
195 PRE_PHI_HUT| PRE_FG_PSI|
196 FFTW_INIT| FFT_OUT_OF_PLACE,
197 FFTW_ESTIMATE| FFTW_DESTROY_INPUT);
206 swapndft=(
double _Complex*)
nfft_malloc(M*
sizeof(
double _Complex));
216 nfft_precompute_one_psi(&np);
232 nfft_trafo_direct(&np);
234 t = nfft_elapsed_seconds(t1,t0);
240 printf(
"%.2e\t",t_ndft);
254 t = nfft_elapsed_seconds(t1,t0);
259 printf(
"%.2f\t%d\t%.2e\t",((
double)n)/N, m, t_nfft);
262 printf(
"%.2e\t",X(error_l_infty_complex)(swapndft, np.
f, np.
M_total));
275 t = nfft_elapsed_seconds(t1,t0);
281 printf(
"%.2f\t%d\t%.2e\t",((
double)n_taylor)/N,m_taylor,t_taylor);
284 printf(
"%.2e\n",X(error_l_infty_complex)(swapndft, np.
f, np.
M_total));
298 int main(
int argc,
char **argv)
304 fprintf(stderr,
"taylor_nfft type first last trials sigma_nfft sigma_taylor.\n");
308 fprintf(stderr,
"Testing the Nfft & a Taylor expansion based version.\n\n");
309 fprintf(stderr,
"Columns: N, M, t_ndft, sigma_nfft, m_nfft, t_nfft, e_nfft");
310 fprintf(stderr,
", sigma_taylor, m_taylor, t_taylor, e_taylor\n");
315 fprintf(stderr,
"Fixed target accuracy, timings.\n\n");
316 for(l=atoi(argv[2]); l<=atoi(argv[3]); l++)
317 for(trial=0; trial<atoi(argv[4]); trial++)
320 (1U<< l)), 6, (
int)(atof(argv[6])*(1U<< l)),
324 (1U<< l)), 6, (
int)(atof(argv[6])*(1U<< l)),
332 fprintf(stderr,
"Fixed N=M=%d, error vs. m.\n\n",N);
333 for(m=atoi(argv[2]); m<=atoi(argv[3]); m++)
334 for(trial=0; trial<atoi(argv[4]); trial++)
336 (
int)(atof(argv[6])*N), m, 1);