NFFT Logo 3.1.1 API Reference

simple_test.c

00001 /*
00002  * Copyright (c) 2002, 2009 Jens Keiner, Stefan Kunis, Daniel Potts
00003  *
00004  * This program is free software; you can redistribute it and/or modify it under
00005  * the terms of the GNU General Public License as published by the Free Software
00006  * Foundation; either version 2 of the License, or (at your option) any later
00007  * version.
00008  *
00009  * This program is distributed in the hope that it will be useful, but WITHOUT
00010  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00011  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
00012  * details.
00013  *
00014  * You should have received a copy of the GNU General Public License along with
00015  * this program; if not, write to the Free Software Foundation, Inc., 51
00016  * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  */
00018 
00019 /* $Id: simple_test.c 3198 2009-05-27 14:16:50Z keiner $ */
00020 
00021 #include <stdio.h>
00022 #include <math.h>
00023 #include <string.h>
00024 #include <stdlib.h>
00025 #include <complex.h>
00026 
00027 #include "nfft3util.h"
00028 #include "nfft3.h"
00029 
00030 void simple_test_nsfft(int d, int J, int M)
00031 {
00032   int K=12;
00033   nsfft_plan p;
00034 
00035   nsfft_init(&p, d, J, M, 6, NSDFT);
00036 
00037   nsfft_init_random_nodes_coeffs(&p);
00038 
00039   nfft_vpr_complex(p.f_hat, K, "frequencies, vector f_hat (first few entries)");
00040 
00042   nsdft_trafo(&p);
00043   nfft_vpr_complex(p.f, K, "nsdft, vector f (first few entries)");
00044 
00046   nsfft_trafo(&p);
00047   nfft_vpr_complex(p.f, K, "nsfft, vector f (first few entries)");
00048 
00050   nsdft_adjoint(&p);
00051   nfft_vpr_complex(p.f_hat, K, "adjoint nsdft, vector f_hat, (first few entries)");
00052 
00054   nsfft_adjoint(&p);
00055   nfft_vpr_complex(p.f_hat, K, "adjoint nsfft, vector f_hat, (first few entries)");
00056 
00058   nsfft_finalize(&p);
00059 }
00060 
00061 int main(int argc,char **argv)
00062 {
00063   int d, J, M;
00064 
00065   system("clear");
00066   printf("1) computing a two dimensional nsdft, nsfft and adjoints\n\n");
00067   d=2;
00068   J=5;
00069   M=(J+4)*nfft_int_2_pow(J+1);
00070   simple_test_nsfft(d,J,M);
00071   getc(stdin);
00072 
00073   system("clear");
00074   printf("2) computing a three dimensional nsdft, nsfft and adjoints\n\n");
00075   d=3;
00076   J=5;
00077   M=6*nfft_int_2_pow(J)*(nfft_int_2_pow((J+1)/2+1)-1)+nfft_int_2_pow(3*(J/2+1));
00078   simple_test_nsfft(d,J,M);
00079 
00080   return 1;
00081 }

Generated on 17 Aug 2009 by Doxygen 1.5.3