next up previous contents
Next: Computation time vs. problem Up: Examples Previous: Examples   Contents


Computing your first transform

The following code summarises the steps of Section 4.2 and computes a univariate NFFT from 14 Fourier coefficients and 19 nodes. Note that this routine is part of simple_test.c in examples/nfft/ and uses additional routines as defined include/util.h to set up and show vectors.

void simple_test_nfft_1d()
{
  nfft_plan p;
  int N=14;
  int M=19;

  nfft_init_1d(&p,N,M);

  nfft_vrand_shifted_unit_double(p.x,p.M_total);

  if(p.nfft_flags & PRE_ONE_PSI)
    nfft_precompute_one_psi(&p);

  nfft_vrand_unit_complex(p.f_hat,p.N_total);
  nfft_vpr_complex(p.f_hat,p.N_total,"given Fourier coefficients, f_hat");

  ndft_trafo(&p);
  nfft_vpr_complex(p.f,p.M_total,"ndft, f");

  nfft_trafo(&p);
  nfft_vpr_complex(p.f,p.M_total,"nfft, f");

  nfft_finalize(&p);
}



Jens Keiner 2006-11-20