![]() |
NFFT
3.3.1
|
00001 /* 00002 * Copyright (c) 2002, 2016 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 #include <stdio.h> 00020 #include <math.h> 00021 #include <string.h> 00022 #include <stdlib.h> 00023 00024 #define NFFT_PRECISION_DOUBLE 00025 00026 #include "nfft3mp.h" 00027 00028 static void simple_test_nfst_1d(void) 00029 { 00030 NFST(plan) p; 00031 00032 const char *error_str; 00033 00034 int N = 14; 00035 int M = 19; 00036 00038 NFST(init_1d)(&p,N,M); 00039 00041 NFFT(vrand_real)(p.x, p.M_total, NFFT_K(0.0), NFFT_K(0.5)); 00042 00044 if( p.flags & PRE_ONE_PSI) 00045 NFST(precompute_one_psi)(&p); 00046 00048 NFFT(vrand_real)(p.f_hat, p.N_total, NFFT_K(0.0), NFFT_K(1.0)); 00049 NFFT(vpr_double)(p.f_hat,p.N_total,"given Fourier coefficients, vector f_hat"); 00050 00052 error_str = NFST(check)(&p); 00053 if (error_str != 0) 00054 { 00055 printf("Error in nfst module: %s\n", error_str); 00056 return; 00057 } 00058 00060 NFST(trafo_direct)(&p); 00061 NFFT(vpr_double)(p.f,p.M_total,"ndst, vector f"); 00062 00064 NFST(trafo)(&p); 00065 NFFT(vpr_double)(p.f,p.M_total,"nfst, vector f"); 00066 00068 NFST(adjoint_direct)(&p); 00069 NFFT(vpr_double)(p.f_hat,p.N_total,"adjoint ndst, vector f_hat"); 00070 00072 NFST(adjoint)(&p); 00073 NFFT(vpr_double)(p.f_hat,p.N_total,"adjoint nfst, vector f_hat"); 00074 00076 NFST(finalize)(&p); 00077 } 00078 00079 int main(void) 00080 { 00081 printf("Computing one dimensional ndct, nfct, adjoint ndct, and adjoint nfct...\n\n"); 00082 simple_test_nfst_1d(); 00083 printf("\n\n"); 00084 00085 return EXIT_SUCCESS; 00086 }