41 static void reconstruct(
char* filename,
int N,
int M,
int iteration,
int weight)
52 double epsilon=0.0000003;
54 unsigned infft_flags = CGNR | PRECOMPUTE_DAMP;
58 my_N[0]=N; my_n[0]=ceil(N*alpha);
59 my_N[1]=N; my_n[1]=ceil(N*alpha);
60 nfft_init_guru(&my_plan, 2, my_N, M, my_n, m, PRE_PHI_HUT| PRE_PSI|
61 MALLOC_X| MALLOC_F_HAT| MALLOC_F|
62 FFTW_INIT| FFT_OUT_OF_PLACE,
63 FFTW_MEASURE| FFTW_DESTROY_INPUT);
71 infft_flags = infft_flags | PRECOMPUTE_WEIGHT;
77 if(my_iplan.
flags & PRECOMPUTE_WEIGHT)
79 fin=fopen(
"weights.dat",
"r");
82 fscanf(fin,
"%le ",&my_iplan.
w[j]);
88 if(my_iplan.
flags & PRECOMPUTE_DAMP)
94 double r=sqrt(j2*j2+k2*k2);
96 my_iplan.
w_hat[j*N+k]=0.0;
98 my_iplan.
w_hat[j*N+k]=1.0;
104 fin=fopen(filename,
"r");
109 fscanf(fin,
"%le %le %le %le ",&my_plan.
x[2*j+0],&my_plan.
x[2*j+1],
111 my_iplan.
y[j] = real + _Complex_I*imag;
118 nfft_precompute_psi(&my_plan);
122 nfft_precompute_full_psi(&my_plan);
131 solver_before_loop_complex(&my_iplan);
132 for(l=0;l<iteration;l++)
137 fprintf(stderr,
"%e, %i of %i\n",sqrt(my_iplan.
dot_r_iter),
144 t=nfft_elapsed_seconds(t1,t0);
146 fout_real=fopen(
"output_real.dat",
"w");
147 fout_imag=fopen(
"output_imag.dat",
"w");
149 for(k=0;k<my_plan.
N_total;k++) {
150 fprintf(fout_real,
"%le ", creal(my_iplan.
f_hat_iter[k]));
151 fprintf(fout_imag,
"%le ", cimag(my_iplan.
f_hat_iter[k]));
161 nfft_finalize(&my_plan);
164 int main(
int argc,
char **argv)
167 printf(
"usage: ./reconstruct_data_2d FILENAME N M ITER WEIGHTS\n");
171 reconstruct(argv[1],atoi(argv[2]),atoi(argv[3]),atoi(argv[4]),atoi(argv[5]));