| NFFT 3.5.0

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

nsfft/simple_test.c
1 /*
2 * Copyright (c) 2002, 2017 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 #include <stdio.h>
20 #include <math.h>
21 #include <string.h>
22 #include <stdlib.h>
23 #include <complex.h>
24
25 #include "nfft3.h"
26
27 static void simple_test_nsfft(int d, int J, int M)
28 {
29 int K=12;
30 nsfft_plan p;
31
32 nsfft_init(&p, d, J, M, 6, NSDFT);
33
34 nsfft_init_random_nodes_coeffs(&p);
35
36 nfft_vpr_complex(p.f_hat, K, "frequencies, vector f_hat (first few entries)");
37
39 nsfft_trafo_direct(&p);
40 nfft_vpr_complex(p.f, K, "nsdft, vector f (first few entries)");
41
43 nsfft_trafo(&p);
44 nfft_vpr_complex(p.f, K, "nsfft, vector f (first few entries)");
45
47 nsfft_adjoint_direct(&p);
48 nfft_vpr_complex(p.f_hat, K, "adjoint nsdft, vector f_hat, (first few entries)");
49
51 nsfft_adjoint(&p);
52 nfft_vpr_complex(p.f_hat, K, "adjoint nsfft, vector f_hat, (first few entries)");
53
55 nsfft_finalize(&p);
56 }
57
58 int main(int argc,char **argv)
59 {
60 int d, J, M;
61
62 system("clear");
63 printf("1) computing a two dimensional nsdft, nsfft and adjoints\n\n");
64 d=2;
65 J=5;
66 M=(J+4)*nfft_exp2i(J+1);
67 simple_test_nsfft(d,J,M);
68 getc(stdin);
69
70 system("clear");
71 printf("2) computing a three dimensional nsdft, nsfft and adjoints\n\n");
72 d=3;
73 J=5;
74 M=6*nfft_exp2i(J)*(nfft_exp2i((J+1)/2+1)-1)+nfft_exp2i(3*(J/2+1));
75 simple_test_nsfft(d,J,M);
76
77 return 1;
78 }
nsfft_init
void nsfft_init(nsfft_plan *ths, int d, int J, int M, int m, unsigned flags)
Definition: nsfft.c:1778
nsfft_plan::f
fftw_complex * f
Samples.
Definition: nfft3.h:475
nfft_vpr_complex
void nfft_vpr_complex(fftw_complex *x, const NFFT_INT n, const char *text)
Print complex vector to standard output.
nsfft_init_random_nodes_coeffs
void nsfft_init_random_nodes_coeffs(nsfft_plan *ths)
Definition: nsfft.c:723
nsfft_adjoint
void nsfft_adjoint(nsfft_plan *ths)
Definition: nsfft.c:1549
nfft3.h
Header file for the nfft3 library.
nsfft_finalize
void nsfft_finalize(nsfft_plan *ths)
Definition: nsfft.c:1885
NSDFT
#define NSDFT
Definition: nfft3.h:476
nsfft_trafo
void nsfft_trafo(nsfft_plan *ths)
Definition: nsfft.c:1541
nsfft_plan
data structure for an NSFFT (nonequispaced sparse fast Fourier transform) plan with double precision ...
Definition: nfft3.h:475
nsfft_plan::f_hat
fftw_complex * f_hat
Fourier coefficients.
Definition: nfft3.h:475