48 #define DGT_PRE_CEXP     (1U<< 0) 
   59 #define FGT_NDFT         (1U<< 1) 
   69 #define FGT_APPROX_B     (1U<< 2) 
  111   for(j=0; j<ths->
M; j++)
 
  115     for(j=0,l=0; j<ths->
M; j++)
 
  116       for(k=0; k<ths->
N; k++,l++)
 
  119     for(j=0; j<ths->M; j++)
 
  120       for(k=0; k<ths->
N; k++)
 
  121         ths->
f[j] += ths->
alpha[k]*cexp(-ths->
sigma*(ths->
y[j]-ths->
x[k])*
 
  122           (ths->
y[j]-ths->
x[k]));
 
  138       nfft_adjoint_direct(ths->
nplan1);
 
  140       for(l=0; l<ths->
n; l++)
 
  143       nfft_trafo_direct(ths->
nplan2);
 
  147       nfft_adjoint(ths->
nplan1);
 
  149       for(l=0; l<ths->
n; l++)
 
  171        double p, 
int m, 
unsigned flags)
 
  184   ths->
f = (
double _Complex*)
nfft_malloc(ths->
M*
sizeof(
double _Complex));
 
  189   ths->
b = (
double _Complex*)
nfft_malloc(ths->
n*
sizeof(
double _Complex));
 
  194   n_fftw=X(next_power_of_2)(2*ths->
n);
 
  196   nfft_init_guru(ths->
nplan1, 1, &(ths->
n), ths->
N, &n_fftw, m, PRE_PHI_HUT|
 
  197                  PRE_PSI| MALLOC_X| MALLOC_F_HAT| FFTW_INIT, FFTW_MEASURE);
 
  198   nfft_init_guru(ths->
nplan2, 1, &(ths->
n), ths->
M, &n_fftw, m, PRE_PHI_HUT|
 
  199                  PRE_PSI| MALLOC_X| FFTW_INIT, FFTW_MEASURE);
 
  207       fplan = fftw_plan_dft_1d(ths->
n, ths->
b, ths->
b, FFTW_FORWARD,
 
  210       for(j=0; j<ths->
n; j++)
 
  211   ths->
b[j] = cexp(-ths->
p*ths->
p*ths->
sigma*(j-ths->
n/2)*(j-ths->
n/2)/
 
  212                           ((
double)ths->
n*ths->
n)) / ths->
n;
 
  218       fftw_destroy_plan(fplan);
 
  222       for(j=0; j<ths->
n; j++)
 
  223   ths->
b[j] = 1.0/ths->
p * csqrt(
PI/ths->
sigma)*
 
  224     cexp(-
PI*
PI*(j-ths->
n/2)*(j-ths->
n/2)/
 
  245   p=0.5+sqrt(-log(eps)/creal(sigma));
 
  249   n=2*((int)ceil(p*cabs(sigma)/
PI * sqrt(-log(eps)/creal(sigma))));
 
  251   if(N*M<=((
int)(1U<<20)))
 
  270             sizeof(
double _Complex));
 
  272      for(j=0,l=0; j<ths->
M; j++)
 
  273        for(k=0; k<ths->
N; k++,l++)
 
  275                                 (ths->
y[j]-ths->
x[k]));
 
  280   for(j=0; j<ths->nplan2->M_total; j++)
 
  284     nfft_precompute_psi(ths->
nplan1);
 
  286     nfft_precompute_psi(ths->
nplan2);
 
  297   nfft_finalize(ths->
nplan2);
 
  298   nfft_finalize(ths->
nplan1);
 
  322   for(k=0; k<ths->
N; k++)
 
  323     ths->
x[k] = (
double)rand()/(2.0*RAND_MAX)-1.0/4.0;
 
  325   for(j=0; j<ths->
M; j++)
 
  326     ths->
y[j] = (
double)rand()/(2.0*RAND_MAX)-1.0/4.0;
 
  328   for(k=0; k<ths->
N; k++)
 
  329     ths->
alpha[k] =   (
double)rand()/(RAND_MAX)-1.0/2.0
 
  330             + _Complex_I*(
double)rand()/(RAND_MAX)-I/2.0;
 
  359       t_out += nfft_elapsed_seconds(t1,t0);
 
  378   double _Complex *swap_dgt;
 
  380   fgt_init(&my_plan, N, M, sigma, eps);
 
  381   swap_dgt = (
double _Complex*)
nfft_malloc(my_plan.
M*
sizeof(
double _Complex));
 
  394   printf(
"\n relative error: %1.3e\n", X(error_l_infty_1_complex)(swap_dgt,
 
  395          my_plan.
f, my_plan.
M, my_plan.
alpha, my_plan.
N));
 
  413   double _Complex *swap_dgt;
 
  416   double _Complex sigma=4*(138+ _Complex_I*100);
 
  418   int N_dgt_pre_exp=(int)(1U<<11);
 
  419   int N_dgt=(int)(1U<<19);
 
  421   printf(
"n=%d, sigma=%1.3e+i%1.3e\n",n,creal(sigma),cimag(sigma));
 
  423   for(N=((
int)(1U<<6)); N<((int)(1U<<22)); N=N<<1)
 
  425       printf(
"$%d$\t & ",N);
 
  433                 sizeof(
double _Complex));
 
  464       printf(
"$%1.1e$\t \\\\ \n",
 
  465        X(error_l_infty_1_complex)(swap_dgt, my_plan.
f, my_plan.
M,
 
  466             my_plan.
alpha, my_plan.
N));
 
  484   double _Complex *swap_dgt;
 
  487   double _Complex sigma=4*(138+ _Complex_I*100);
 
  492   printf(
"N=%d;\tM=%d;\nsigma=%1.3e+i*%1.3e;\n",N,M,creal(sigma),cimag(sigma));
 
  495   swap_dgt = (
double _Complex*)
nfft_malloc(M*
sizeof(
double _Complex));
 
  497   for(n=8; n<=128; n+=4)
 
  512           printf(
"%1.3e\t", X(error_l_infty_1_complex)(swap_dgt, my_plan.
f,
 
  513                  my_plan.
M, my_plan.
alpha, my_plan.
N));
 
  535   double _Complex *swap_dgt;
 
  538   double _Complex sigma=20+40*_Complex_I;
 
  541   double p[3]={1,1.5,2};
 
  543   printf(
"N=%d;\tM=%d;\nsigma=%1.3e+i*%1.3e;\n",N,M,creal(sigma),cimag(sigma));
 
  546   swap_dgt = (
double _Complex*)
nfft_malloc(M*
sizeof(
double _Complex));
 
  548   for(n=8; n<=128; n+=4)
 
  563           printf(
"%1.3e\t", X(error_l_infty_1_complex)(swap_dgt, my_plan.
f,
 
  564                  my_plan.
M, my_plan.
alpha, my_plan.
N));
 
  580 int main(
int argc,
char **argv)
 
  584       fprintf(stderr,
"fastgauss type\n");
 
  585       fprintf(stderr,
" type\n");
 
  586       fprintf(stderr,
"  0 - Simple test.\n");
 
  587       fprintf(stderr,
"  1 - Compares accuracy and execution time.\n");
 
  588       fprintf(stderr,
"      Pipe to output_andersson.tex\n");
 
  589       fprintf(stderr,
"  2 - Compares accuracy.\n");
 
  590       fprintf(stderr,
"      Pipe to output_error.m\n");
 
  591       fprintf(stderr,
"  3 - Compares accuracy.\n");
 
  592       fprintf(stderr,
"      Pipe to output_error_p.m\n");