NFFT Logo 3.2.3
nsfft/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 #include "config.h"
21 
22 #include <stdio.h>
23 #include <math.h>
24 #include <string.h>
25 #include <stdlib.h>
26 #ifdef HAVE_COMPLEX_H
27 #include <complex.h>
28 #endif
29 
30 #include "nfft3util.h"
31 #include "nfft3.h"
32 #include "infft.h"
33 
34 static void simple_test_nsfft(int d, int J, int M)
35 {
36  int K=12;
37  nsfft_plan p;
38 
39  nsfft_init(&p, d, J, M, 6, NSDFT);
40 
41  nsfft_init_random_nodes_coeffs(&p);
42 
43  nfft_vpr_complex(p.f_hat, K, "frequencies, vector f_hat (first few entries)");
44 
46  nsfft_trafo_direct(&p);
47  nfft_vpr_complex(p.f, K, "nsdft, vector f (first few entries)");
48 
50  nsfft_trafo(&p);
51  nfft_vpr_complex(p.f, K, "nsfft, vector f (first few entries)");
52 
54  nsfft_adjoint_direct(&p);
55  nfft_vpr_complex(p.f_hat, K, "adjoint nsdft, vector f_hat, (first few entries)");
56 
58  nsfft_adjoint(&p);
59  nfft_vpr_complex(p.f_hat, K, "adjoint nsfft, vector f_hat, (first few entries)");
60 
62  nsfft_finalize(&p);
63 }
64 
65 int main(int argc,char **argv)
66 {
67  int d, J, M;
68 
69  system("clear");
70  printf("1) computing a two dimensional nsdft, nsfft and adjoints\n\n");
71  d=2;
72  J=5;
73  M=(J+4)*X(exp2i)(J+1);
74  simple_test_nsfft(d,J,M);
75  getc(stdin);
76 
77  system("clear");
78  printf("2) computing a three dimensional nsdft, nsfft and adjoints\n\n");
79  d=3;
80  J=5;
81  M=6*X(exp2i)(J)*(X(exp2i)((J+1)/2+1)-1)+X(exp2i)(3*(J/2+1));
82  simple_test_nsfft(d,J,M);
83 
84  return 1;
85 }

Generated on Tue Apr 30 2013 by Doxygen 1.8.1