42 static void reconstruct(
char* filename,
int N,
int M,
int iteration, 
int weight)
 
   54   double t,epsilon=0.0000003;     
 
   56   unsigned infft_flags = CGNR | PRECOMPUTE_DAMP; 
 
   57   double time,min_time,max_time,min_inh,max_inh;
 
   69   ftime=fopen(
"readout_time.dat",
"r");
 
   70   finh=fopen(
"inh.dat",
"r");
 
   72   min_time=INT_MAX; max_time=INT_MIN;
 
   75     fscanf(ftime,
"%le ",&time);
 
   84   Ts=(min_time+max_time)/2.0;
 
   86   min_inh=INT_MAX; max_inh=INT_MIN;
 
   89     fscanf(finh,
"%le ",&w[j]);
 
   97   N3=ceil((
NFFT_MAX(fabs(min_inh),fabs(max_inh))*(max_time-min_time)/2.0)*4);
 
  100   W=
NFFT_MAX(fabs(min_inh),fabs(max_inh))*2.0;
 
  102   fprintf(stderr,
"3:  %i %e %e %e %e %e %e\n",N3,W,min_inh,max_inh,min_time,max_time,Ts);
 
  105   my_N[0]=N;my_n[0]=ceil(N*sigma);
 
  106   my_N[1]=N; my_n[1]=ceil(N*sigma);
 
  107   my_N[2]=N3; my_n[2]=ceil(N3*sigma);
 
  108   nnfft_init_guru(&my_plan, 3, N*N, M, my_N,my_n,m,
 
  109         PRE_PSI| PRE_PHI_HUT| MALLOC_X| MALLOC_V| MALLOC_F_HAT| MALLOC_F );
 
  117     infft_flags = infft_flags | PRECOMPUTE_WEIGHT;
 
  123   if(my_iplan.
flags & PRECOMPUTE_WEIGHT)
 
  125     fin=fopen(
"weights.dat",
"r");
 
  128         fscanf(fin,
"%le ",&my_iplan.
w[j]);
 
  134   if(my_iplan.
flags & PRECOMPUTE_DAMP)
 
  140         double r=sqrt(j2*j2+k2*k2);
 
  142           my_iplan.
w_hat[j*N+k]=0.0;
 
  144           my_iplan.
w_hat[j*N+k]=1.0;
 
  150   fin=fopen(filename,
"r");
 
  151   ftime=fopen(
"readout_time.dat",
"r");
 
  155     fscanf(fin,
"%le %le %le %le ",&my_plan.
x[3*j+0],&my_plan.
x[3*j+1],&real,&imag);
 
  156     my_iplan.
y[j]=real+ _Complex_I*imag;
 
  157     fscanf(ftime,
"%le ",&my_plan.
x[3*j+2]);
 
  159     my_plan.
x[3*j+2] = (my_plan.
x[3*j+2]-Ts)*W/N3;
 
  166         my_plan.
v[3*(N*j+l)+0]=(((
double) j) -(((
double) N)/2.0))/((
double) N);
 
  167         my_plan.
v[3*(N*j+l)+1]=(((
double) l) -(((
double) N)/2.0))/((
double) N);
 
  168         my_plan.
v[3*(N*j+l)+2] = w[N*j+l]/W ;
 
  174     nnfft_precompute_psi(&my_plan);
 
  191   solver_before_loop_complex(&my_iplan);
 
  192   for(l=0;l<iteration;l++)
 
  197     fprintf(stderr,
"%e,  %i of %i\n",sqrt(my_iplan.
dot_r_iter),
 
  203   t = nfft_elapsed_seconds(t1,t0);
 
  205   fout_real=fopen(
"output_real.dat",
"w");
 
  206   fout_imag=fopen(
"output_imag.dat",
"w");
 
  208   for(k=0;k<my_plan.
N_total;k++) {
 
  210     my_iplan.
f_hat_iter[k]*=cexp(2.0*_Complex_I*
PI*Ts*w[k]);
 
  212     fprintf(fout_real,
"%le ", creal(my_iplan.
f_hat_iter[k]));
 
  213     fprintf(fout_imag,
"%le ", cimag(my_iplan.
f_hat_iter[k]));
 
  225   nnfft_finalize(&my_plan);
 
  230 int main(
int argc, 
char **argv)
 
  233     printf(
"usage: ./reconstruct_data_inh_nnfft FILENAME N M ITER WEIGHTS\n");
 
  237   reconstruct(argv[1],atoi(argv[2]),atoi(argv[3]),atoi(argv[4]),atoi(argv[5]));