29 static void simple_test_nfsoft(
int bw,
int M)
31 nfsoft_plan plan_nfsoft;
32 nfsoft_plan plan_ndsoft;
60 for (j = 0; j < plan_nfsoft.M_total; j++)
62 d1 = ((double) rand()) / RAND_MAX - 0.5;
63 d2 = 0.5 * ((double) rand()) / RAND_MAX;
64 d3 = ((double) rand()) / RAND_MAX - 0.5;
66 plan_nfsoft.x[3* j ] = d1;
67 plan_nfsoft.x[3* j + 1] = d2;
68 plan_nfsoft.x[3* j + 2] = d3;
70 plan_ndsoft.x[3* j ] = d1;
71 plan_ndsoft.x[3* j + 1] = d2;
72 plan_ndsoft.x[3* j + 2] = d3;
76 for (j = 0; j < (bw + 1) * (4* (bw +1)*(bw+1)-1)/3;j++)
78 d1=((double)rand())/RAND_MAX - 0.5;
79 d2=((double)rand())/RAND_MAX - 0.5;
80 plan_nfsoft.f_hat[j]=d1 + I*d2;
81 plan_ndsoft.f_hat[j]=d1 + I*d2;
84 if ((bw+1)*(4*(bw+1)*(bw+1)-1)/3<=20)
85 nfft_vpr_complex(plan_nfsoft.f_hat,(bw+1)*(4*(bw+1)*(bw+1)-1)/3,
"randomly generated SO(3) Fourier coefficients");
87 nfft_vpr_complex(plan_ndsoft.f_hat,20,
"1st-20th randomly generated SO(3) Fourier coefficient");
89 printf(
"\n---------------------------------------------\n");
97 t0 = nfft_clock_gettime_seconds();
99 t1 = nfft_clock_gettime_seconds();
101 if (plan_nfsoft.M_total<=20)
102 nfft_vpr_complex(plan_nfsoft.f,plan_nfsoft.M_total,
"NFSOFT, function samples");
104 nfft_vpr_complex(plan_nfsoft.f,20,
"NFSOFT, 1st-20th function sample");
105 printf(
" computed in %11le seconds\n",time);
108 t0 = nfft_clock_gettime_seconds();
110 t1 = nfft_clock_gettime_seconds();
112 if (plan_ndsoft.M_total<=20)
113 nfft_vpr_complex(plan_ndsoft.f,plan_ndsoft.M_total,
"NDSOFT, function samples");
115 nfft_vpr_complex(plan_ndsoft.f,20,
"NDSOFT, 1st-20th function sample");
116 printf(
" computed in %11le seconds\n",time);
119 error= nfft_error_l_infty_complex(plan_ndsoft.f,plan_nfsoft.f, plan_nfsoft.M_total);
120 printf(
"\n The NFSOFT of bandwidth=%d for %d rotations has infty-error %11le \n",bw, M,error);
122 printf(
"\n---------------------------------------------\n");
124 plan_nfsoft.f[0]=1.0;
125 plan_ndsoft.f[0]=1.0;
126 nfft_vpr_complex(plan_ndsoft.f,plan_ndsoft.M_total,
"function samples to start adjoint trafo");
129 t0 = nfft_clock_gettime_seconds();
131 t1 = nfft_clock_gettime_seconds();
133 if ((bw+1)*(4*(bw+1)*(bw+1)-1)/3<=20)
134 nfft_vpr_complex(plan_nfsoft.f_hat,(bw+1)*(4*(bw+1)*(bw+1)-1)/3,
"SO(3) Fourier coefficients");
136 nfft_vpr_complex(plan_nfsoft.f_hat,20,
"adjoint NFSOFT, 1st-20th Fourier coefficient");
137 printf(
" computed in %11le seconds\n",time);
140 t0 = nfft_clock_gettime_seconds();
142 t1 = nfft_clock_gettime_seconds();
144 if ((bw+1)*(4*(bw+1)*(bw+1)-1)/3<=20)
145 nfft_vpr_complex(plan_ndsoft.f_hat,(bw+1)*(4*(bw+1)*(bw+1)-1)/3,
"SO(3) Fourier coefficients");
147 nfft_vpr_complex(plan_ndsoft.f_hat,20,
"adjoint NDSOFT, 1st-20th Fourier coefficient");
148 printf(
" computed in %11le seconds\n",time);
152 error=nfft_error_l_infty_complex(plan_ndsoft.f_hat,plan_nfsoft.f_hat, (bw+1)*(4*(bw+1)*(bw+1)-1)/3);
153 printf(
"\n The adjoint NFSOFT of bandwidth=%d for %d rotations has infty-error %11le \n",bw, M,error);
155 printf(
"\n---------------------------------------------\n");
178 int main(
int argc,
char **argv)
186 "This test programm computes the NFSOFT with maximum polynomial degree N at M input rotations\n");
187 printf(
"Usage: simple_test N M \n");
188 printf(
"e.g.: simple_test 8 64\n");
197 "computing an NDSOFT, an NFSOFT, an adjoint NDSOFT, and an adjoint NFSOFT\n\n");
199 simple_test_nfsoft(N, M);
void nfsoft_finalize(nfsoft_plan *plan)
#define NFSOFT_MALLOC_F_HAT
void nfsoft_adjoint(nfsoft_plan *plan3D)
void nfsoft_init_guru(nfsoft_plan *plan, int B, int M, unsigned int nfsoft_flags, unsigned int nfft_flags, int nfft_cutoff, int fpt_kappa)
void nfsoft_trafo(nfsoft_plan *plan3D)
void nfsoft_precompute(nfsoft_plan *plan3D)
Header file for the nfft3 library.