30 #define K(x) ((double) x) 32 static void simple_test_nfsft(
void)
40 nfsft_precompute(N,1000.0,0U,0U);
48 nfsft_init_guru(&plan, N, M, NFSFT_MALLOC_X | NFSFT_MALLOC_F |
49 NFSFT_MALLOC_F_HAT | NFSFT_NORMALIZED | NFSFT_PRESERVE_F_HAT,
50 PRE_PHI_HUT | PRE_PSI | FFTW_INIT | FFT_OUT_OF_PLACE, 6);
53 for (j = 0; j < plan.
M_total; j++)
55 plan.
x[2*j]= nfft_drand48() - K(0.5);
56 plan.
x[2*j+1]= K(0.5) * nfft_drand48();
60 nfsft_precompute_x(&plan);
63 for (k = 0; k <= plan.
N; k++)
64 for (n = -k; n <= k; n++)
65 plan.
f_hat[NFSFT_INDEX(k,n,&plan)] =
66 nfft_drand48() - K(0.5) + _Complex_I*(nfft_drand48() - K(0.5));
69 nfsft_trafo_direct(&plan);
70 printf(
"Vector f (NDSFT):\n");
71 for (j = 0; j < plan.
M_total; j++)
72 printf(
"f[%+2d] = %+5.3" __FES__
" %+5.3" __FES__
"*I\n",j,
73 creal(plan.
f[j]), cimag(plan.
f[j]));
79 printf(
"Vector f (NFSFT):\n");
80 for (j = 0; j < plan.
M_total; j++)
81 printf(
"f[%+2d] = %+5.3" __FES__
" %+5.3" __FES__
"*I\n",j,
82 creal(plan.
f[j]), cimag(plan.
f[j]));
87 nfsft_adjoint_direct(&plan);
88 printf(
"Vector f_hat (NDSFT):\n");
89 for (k = 0; k <= plan.
N; k++)
90 for (n = -k; n <= k; n++)
91 fprintf(stdout,
"f_hat[%+2d,%+2d] = %+5.3" __FES__
" %+5.3" __FES__
"*I\n",k,n,
92 creal(plan.
f_hat[NFSFT_INDEX(k,n,&plan)]),
93 cimag(plan.
f_hat[NFSFT_INDEX(k,n,&plan)]));
99 printf(
"Vector f_hat (NFSFT):\n");
100 for (k = 0; k <= plan.
N; k++)
102 for (n = -k; n <= k; n++)
104 fprintf(stdout,
"f_hat[%+2d,%+2d] = %+5.3" __FES__
" %+5.3" __FES__
"*I\n",k,n,
105 creal(plan.
f_hat[NFSFT_INDEX(k,n,&plan)]),
106 cimag(plan.
f_hat[NFSFT_INDEX(k,n,&plan)]));
111 nfsft_finalize(&plan);
119 printf(
"Computing an NDSFT, an NFSFT, an adjoint NDSFT, and an adjoint NFSFT" double * x
the nodes for ,
fftw_complex * f_hat
Fourier coefficients.
data structure for an NFSFT (nonequispaced fast spherical Fourier transform) plan with double precisi...
NFFT_INT M_total
Total number of samples.