00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include "config.h"
00022
00023 #include <math.h>
00024 #include <stdlib.h>
00025 #ifdef HAVE_COMPLEX_H
00026 #include <complex.h>
00027 #endif
00028
00029 #include "nfft3util.h"
00030 #include "nfft3.h"
00031 #include "infft.h"
00032
00033 void accuracy(int d)
00034 {
00035 int m,t;
00036 nnfft_plan my_plan;
00037 double _Complex *slow;
00038
00039 int N[d],n[d];
00040 int M_total,N_total;
00041 M_total=10000;N_total=1;
00042
00043 slow=(double _Complex*)nfft_malloc(M_total*sizeof(double _Complex));
00044
00045 for(t=0; t<d; t++)
00046 {
00047 N[t]=(1<<(12/d));
00048 n[t]=2*N[t];
00049 N_total*=N[t];
00050 }
00051
00053 for(m=0; m<10; m++)
00054 {
00055 nnfft_init_guru(&my_plan, d, N_total, M_total, N, n, m,
00056 PRE_PSI| PRE_PHI_HUT|
00057 MALLOC_X| MALLOC_V| MALLOC_F_HAT| MALLOC_F);
00058
00059
00061 nfft_vrand_shifted_unit_double(my_plan.x, d*my_plan.M_total);
00062 nfft_vrand_shifted_unit_double(my_plan.v, d*my_plan.N_total);
00063
00065 if(my_plan.nnfft_flags & PRE_PSI)
00066 nnfft_precompute_psi(&my_plan);
00067
00068 if(my_plan.nnfft_flags & PRE_LIN_PSI)
00069 nnfft_precompute_lin_psi(&my_plan);
00070
00071 if(my_plan.nnfft_flags & PRE_FULL_PSI)
00072 nnfft_precompute_full_psi(&my_plan);
00073
00075 if(my_plan.nnfft_flags & PRE_PHI_HUT)
00076 nnfft_precompute_phi_hut(&my_plan);
00077
00079 nfft_vrand_unit_complex(my_plan.f_hat, my_plan.N_total);
00080
00082 nnfft_trafo_direct(&my_plan);
00083
00084 NFFT_SWAP_complex(my_plan.f,slow);
00085
00087 nnfft_trafo(&my_plan);
00088
00089 printf("%e, %e\n",
00090 X(error_l_infty_complex)(slow, my_plan.f, M_total),
00091 X(error_l_infty_1_complex)(slow, my_plan.f, M_total, my_plan.f_hat,
00092 my_plan.N_total));
00093
00095 nnfft_finalize(&my_plan);
00096 }
00097 }
00098
00099 int main(void)
00100 {
00101 int d;
00102 for(d=1; d<4; d++)
00103 accuracy(d);
00104
00105 return 1;
00106 }