32 #define K(x) ((double) x)
34 static void simple_test_nfsft(
void)
42 nfsft_precompute(N,1000.0,0U,0U);
50 nfsft_init_guru(&plan, N, M, NFSFT_MALLOC_X | NFSFT_MALLOC_F |
51 NFSFT_MALLOC_F_HAT | NFSFT_NORMALIZED | NFSFT_PRESERVE_F_HAT,
52 PRE_PHI_HUT | PRE_PSI | FFTW_INIT | FFT_OUT_OF_PLACE, 6);
55 for (j = 0; j < plan.
M_total; j++)
57 plan.
x[2*j]= nfft_drand48() - K(0.5);
58 plan.
x[2*j+1]= K(0.5) * nfft_drand48();
62 nfsft_precompute_x(&plan);
65 for (k = 0; k <= plan.
N; k++)
66 for (n = -k; n <= k; n++)
67 plan.
f_hat[NFSFT_INDEX(k,n,&plan)] =
68 nfft_drand48() - K(0.5) + _Complex_I*(nfft_drand48() - K(0.5));
71 nfsft_trafo_direct(&plan);
72 printf(
"Vector f (NDSFT):\n");
73 for (j = 0; j < plan.
M_total; j++)
74 printf(
"f[%+2d] = %+5.3" __FES__
" %+5.3" __FES__
"*I\n",j,
75 creal(plan.
f[j]), cimag(plan.
f[j]));
81 printf(
"Vector f (NFSFT):\n");
82 for (j = 0; j < plan.
M_total; j++)
83 printf(
"f[%+2d] = %+5.3" __FES__
" %+5.3" __FES__
"*I\n",j,
84 creal(plan.
f[j]), cimag(plan.
f[j]));
89 nfsft_adjoint_direct(&plan);
90 printf(
"Vector f_hat (NDSFT):\n");
91 for (k = 0; k <= plan.
N; k++)
92 for (n = -k; n <= k; n++)
93 fprintf(stdout,
"f_hat[%+2d,%+2d] = %+5.3" __FES__
" %+5.3" __FES__
"*I\n",k,n,
94 creal(plan.
f_hat[NFSFT_INDEX(k,n,&plan)]),
95 cimag(plan.
f_hat[NFSFT_INDEX(k,n,&plan)]));
100 nfsft_adjoint(&plan);
101 printf(
"Vector f_hat (NFSFT):\n");
102 for (k = 0; k <= plan.
N; k++)
104 for (n = -k; n <= k; n++)
106 fprintf(stdout,
"f_hat[%+2d,%+2d] = %+5.3" __FES__
" %+5.3" __FES__
"*I\n",k,n,
107 creal(plan.
f_hat[NFSFT_INDEX(k,n,&plan)]),
108 cimag(plan.
f_hat[NFSFT_INDEX(k,n,&plan)]));
113 nfsft_finalize(&plan);
121 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.