NFFT Logo 3.2.2
nfst/simple_test.c
00001 /*
00002  * Copyright (c) 2002, 2012 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 3896 2012-10-10 12:19:26Z tovo $ */
00020 
00021 #include <stdio.h>
00022 #include <math.h>
00023 #include <string.h>
00024 #include <stdlib.h>
00025 
00026 #include "nfft3util.h"
00027 #include "nfft3.h"
00028 
00029 static void simple_test_nfst_1d(void)
00030 {
00031   int j,k;
00032   nfst_plan p;
00033 
00034   int N=14;
00035   int M=19;
00036 
00038   nfst_init_1d(&p,N,M);
00039 
00041   for(j = 0; j < p.d*p.M_total; j++)
00042     p.x[j] = 0.5 * ((double)rand()) / RAND_MAX;
00043 
00045   if( p.nfst_flags & PRE_PSI)
00046     nfst_precompute_psi( &p);
00047 
00049   for(k = 0; k < p.N_total; k++)
00050     p.f_hat[k] = (double)rand() / RAND_MAX;
00051 
00052   nfft_vpr_double(p.f_hat,p.N_total,"given Fourier coefficients, vector f_hat");
00053 
00055   nfst_trafo_direct(&p);
00056   nfft_vpr_double(p.f,p.M_total,"ndst, vector f");
00057 
00059   nfst_trafo(&p);
00060   nfft_vpr_double(p.f,p.M_total,"nfst, vector f");
00061 
00063   nfst_adjoint_direct(&p);
00064   nfft_vpr_double(p.f_hat,p.N_total,"adjoint ndst, vector f_hat");
00065 
00067   nfst_adjoint(&p);
00068   nfft_vpr_double(p.f_hat,p.N_total,"adjoint nfst, vector f_hat");
00069 
00071   nfst_finalize(&p);
00072 }
00073 
00074 int main(void)
00075 {
00076   system("clear");
00077   printf("computing one dimensional ndst, nfst and adjoint ndst, nfst\n\n");
00078   simple_test_nfst_1d();
00079   printf("\n\n");
00080 
00081   return 1;
00082 }

Generated on Fri Oct 12 2012 by Doxygen 1.8.0-20120409