33 #define K(x) ((double) x) 35 static void simple_test_nfsft(
void)
43 nfsft_precompute(N,1000.0,0U,0U);
51 nfsft_init_guru(&plan, N, M, NFSFT_MALLOC_X | NFSFT_MALLOC_F |
52 NFSFT_MALLOC_F_HAT | NFSFT_NORMALIZED | NFSFT_PRESERVE_F_HAT,
53 PRE_PHI_HUT | PRE_PSI | FFTW_INIT | FFT_OUT_OF_PLACE, 6);
56 for (j = 0; j < plan.
M_total; j++)
58 plan.
x[2*j]= nfft_drand48() - K(0.5);
59 plan.
x[2*j+1]= K(0.5) * nfft_drand48();
63 nfsft_precompute_x(&plan);
66 for (k = 0; k <= plan.
N; k++)
67 for (n = -k; n <= k; n++)
68 plan.
f_hat[NFSFT_INDEX(k,n,&plan)] =
69 nfft_drand48() - K(0.5) + _Complex_I*(nfft_drand48() - K(0.5));
72 nfsft_trafo_direct(&plan);
73 printf(
"Vector f (NDSFT):\n");
74 for (j = 0; j < plan.
M_total; j++)
75 printf(
"f[%+2d] = %+5.3" __FES__
" %+5.3" __FES__
"*I\n",j,
76 creal(plan.
f[j]), cimag(plan.
f[j]));
81 printf(
"Vector f (NDSFT):\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(
"nthreads = %d\n", nfft_get_num_threads());
126 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.