00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "config.h"
00021
00022 #include <stdio.h>
00023 #include <math.h>
00024 #include <string.h>
00025 #include <stdlib.h>
00026 #ifdef HAVE_COMPLEX_H
00027 #include <complex.h>
00028 #endif
00029
00030 #include "nfft3util.h"
00031 #include "nfft3.h"
00032 #include "infft.h"
00033
00034 static void simple_test_nsfft(int d, int J, int M)
00035 {
00036 int K=12;
00037 nsfft_plan p;
00038
00039 nsfft_init(&p, d, J, M, 6, NSDFT);
00040
00041 nsfft_init_random_nodes_coeffs(&p);
00042
00043 nfft_vpr_complex(p.f_hat, K, "frequencies, vector f_hat (first few entries)");
00044
00046 nsfft_trafo_direct(&p);
00047 nfft_vpr_complex(p.f, K, "nsdft, vector f (first few entries)");
00048
00050 nsfft_trafo(&p);
00051 nfft_vpr_complex(p.f, K, "nsfft, vector f (first few entries)");
00052
00054 nsfft_adjoint_direct(&p);
00055 nfft_vpr_complex(p.f_hat, K, "adjoint nsdft, vector f_hat, (first few entries)");
00056
00058 nsfft_adjoint(&p);
00059 nfft_vpr_complex(p.f_hat, K, "adjoint nsfft, vector f_hat, (first few entries)");
00060
00062 nsfft_finalize(&p);
00063 }
00064
00065 int main(int argc,char **argv)
00066 {
00067 int d, J, M;
00068
00069 system("clear");
00070 printf("1) computing a two dimensional nsdft, nsfft and adjoints\n\n");
00071 d=2;
00072 J=5;
00073 M=(J+4)*X(exp2i)(J+1);
00074 simple_test_nsfft(d,J,M);
00075 getc(stdin);
00076
00077 system("clear");
00078 printf("2) computing a three dimensional nsdft, nsfft and adjoints\n\n");
00079 d=3;
00080 J=5;
00081 M=6*X(exp2i)(J)*(X(exp2i)((J+1)/2+1)-1)+X(exp2i)(3*(J/2+1));
00082 simple_test_nsfft(d,J,M);
00083
00084 return 1;
00085 }