39 static void reconstruct(
char* filename,
int N,
int M,
int weight)
50 int flags = PRE_PHI_HUT| PRE_PSI |MALLOC_X| MALLOC_F_HAT|
51 MALLOC_F| FFTW_INIT| FFT_OUT_OF_PLACE|
52 FFTW_MEASURE| FFTW_DESTROY_INPUT;
55 my_N[0]=N; my_n[0]=ceil(N*1.2);
56 my_N[1]=N; my_n[1]=ceil(N*1.2);
57 nfft_init_guru(&my_plan, 2, my_N, M, my_n, 6,flags,
58 FFTW_MEASURE| FFTW_DESTROY_INPUT);
60 fin=fopen(filename,
"r");
62 fweight=fopen(
"weights.dat",
"r");
65 fscanf(fweight,
"%le ",&weights);
66 fscanf(fin,
"%le %le %le %le",&my_plan.
x[2*j+0],&my_plan.
x[2*j+1],&real,&imag);
67 my_plan.
f[j] = real + _Complex_I*imag;
69 my_plan.
f[j] = my_plan.
f[j] * weights;
74 if(my_plan.
flags & PRE_PSI)
75 nfft_precompute_psi(&my_plan);
78 if(my_plan.
flags & PRE_FULL_PSI)
79 nfft_precompute_full_psi(&my_plan);
83 nfft_adjoint(&my_plan);
85 fout_real=fopen(
"output_real.dat",
"w");
86 fout_imag=fopen(
"output_imag.dat",
"w");
89 fprintf(fout_real,
"%le ",creal(my_plan.
f_hat[j]));
90 fprintf(fout_imag,
"%le ",cimag(my_plan.
f_hat[j]));
97 nfft_finalize(&my_plan);
101 int main(
int argc,
char **argv)
104 printf(
"usage: ./reconstruct_data_gridding FILENAME N M ITER WEIGHTS\n");
107 reconstruct(argv[1],atoi(argv[2]),atoi(argv[3]),atoi(argv[5]));
fftw_complex * f_hat
Fourier coefficients.
data structure for an NFFT (nonequispaced fast Fourier transform) plan with double precision ...
NFFT_INT M_total
Total number of samples.
static void reconstruct(char *filename, int N, int M, int weight)
reconstruct makes a 2d-adjoint-nfft
double * x
Nodes in time/spatial domain, size is doubles.
unsigned flags
Flags for precomputation, (de)allocation, and FFTW usage, default setting is PRE_PHI_HUT | PRE_PSI | ...