40 static void reconstruct(
char* filename,
int N,
int M,
int Z,
int iteration, 
int weight)
 
   50   double epsilon=0.0000003;     
 
   53   unsigned infft_flags = CGNR | PRECOMPUTE_DAMP;  
 
   57   my_N[0]=Z; my_n[0]=ceil(Z*1.2);
 
   58   my_N[1]=N; my_n[1]=ceil(N*1.2);
 
   59   my_N[2]=N; my_n[2]=ceil(N*1.2);
 
   60   nfft_init_guru(&my_plan, 3, my_N, M, my_n, 6,
 
   61                       PRE_PHI_HUT| PRE_PSI |MALLOC_X| MALLOC_F_HAT|
 
   62                       MALLOC_F| FFTW_INIT| FFT_OUT_OF_PLACE,
 
   63                       FFTW_MEASURE| FFTW_DESTROY_INPUT);
 
   70     infft_flags = infft_flags | PRECOMPUTE_WEIGHT;
 
   76   if(my_iplan.
flags & PRECOMPUTE_WEIGHT)
 
   78     fin=fopen(
"weights.dat",
"r");
 
   81       fscanf(fin,
"%le ",&my_iplan.
w[j]);
 
   87   if(my_iplan.
flags & PRECOMPUTE_DAMP)
 
   95         double r=sqrt(j2*j2+k2*k2+z2*z2);
 
   97           my_iplan.
w_hat[z*N*N+j*N+k]=0.0;
 
   99           my_iplan.
w_hat[z*N*N+j*N+k]=1.0;
 
  106   fin=fopen(filename,
"r");
 
  109   fout_real=fopen(
"output_real.dat",
"w");
 
  110   fout_imag=fopen(
"output_imag.dat",
"w");
 
  115     fscanf(fin,
"%le %le %le %le %le ",&my_plan.
x[3*j+1],&my_plan.
x[3*j+2], &my_plan.
x[3*j+0],
 
  117     my_iplan.
y[j] = real + _Complex_I*imag;
 
  122     nfft_precompute_psi(&my_plan);
 
  126     nfft_precompute_full_psi(&my_plan);
 
  133   solver_before_loop_complex(&my_iplan);
 
  134   for(l=0;l<iteration;l++)
 
  139     fprintf(stderr,
"%e,  %i of %i\n",sqrt(my_iplan.
dot_r_iter),
 
  149       fprintf(fout_real,
"%le ",creal(my_iplan.
f_hat_iter[ k+N*N*l ]));
 
  150       fprintf(fout_imag,
"%le ",cimag(my_iplan.
f_hat_iter[ k+N*N*l ]));
 
  152     fprintf(fout_real,
"\n");
 
  153     fprintf(fout_imag,
"\n");
 
  160   nfft_finalize(&my_plan);
 
  163 int main(
int argc, 
char **argv)
 
  166     printf(
"usage: ./reconstruct3D FILENAME N M Z ITER WEIGHTS\n");
 
  170   reconstruct(argv[1],atoi(argv[2]),atoi(argv[3]),atoi(argv[4]),atoi(argv[5]),atoi(argv[6]));