NFFT Logo 3.2.3
nfct/simple_test.c
1 /*
2  * Copyright (c) 2002, 2012 Jens Keiner, Stefan Kunis, Daniel Potts
3  *
4  * This program is free software; you can redistribute it and/or modify it under
5  * the terms of the GNU General Public License as published by the Free Software
6  * Foundation; either version 2 of the License, or (at your option) any later
7  * version.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12  * details.
13  *
14  * You should have received a copy of the GNU General Public License along with
15  * this program; if not, write to the Free Software Foundation, Inc., 51
16  * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  */
18 
19 /* $Id: simple_test.c 3896 2012-10-10 12:19:26Z tovo $ */
20 
21 #include <stdio.h>
22 #include <math.h>
23 #include <string.h>
24 #include <stdlib.h>
25 
26 #include "nfft3util.h"
27 #include "nfft3.h"
28 
29 static void simple_test_nfct_1d(void)
30 {
31  int j,k;
32  nfct_plan p;
33 
34  int N=14;
35  int M=19;
36 
38  nfct_init_1d(&p,N,M);
39 
41  for(j = 0; j < p.d*p.M_total; j++)
42  p.x[j] = 0.5 * ((double)rand()) / RAND_MAX;
43 
45  if( p.nfct_flags & PRE_PSI)
46  nfct_precompute_psi( &p);
47 
49  for(k = 0; k < p.N_total; k++)
50  p.f_hat[k] = (double)rand() / RAND_MAX;
51 
52  nfft_vpr_double(p.f_hat,p.N_total,"given Fourier coefficients, vector f_hat");
53 
55  nfct_trafo_direct(&p);
56  nfft_vpr_double(p.f,p.M_total,"ndct, vector f");
57 
59  nfct_trafo(&p);
60  nfft_vpr_double(p.f,p.M_total,"nfct, vector f");
61 
63  nfct_adjoint(&p);
64  nfft_vpr_double(p.f_hat,p.N_total,"adjoint ndct, vector f_hat");
65 
67  nfct_adjoint_direct(&p);
68  nfft_vpr_double(p.f_hat,p.N_total,"adjoint nfct, vector f_hat");
69 
71  nfct_finalize(&p);
72 }
73 
74 int main(void)
75 {
76  system("clear");
77  printf("computing one dimensional ndct, nfct and adjoint ndct, nfct\n\n");
78  simple_test_nfct_1d();
79  printf("\n\n");
80 
81  return 1;
82 }

Generated on Tue Apr 30 2013 by Doxygen 1.8.1