![]() |
NFFT
3.3.2
|
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 #include <complex.h> 00024 00025 #include "nfft3.h" 00026 00027 static void simple_test_nsfft(int d, int J, int M) 00028 { 00029 int K=12; 00030 nsfft_plan p; 00031 00032 nsfft_init(&p, d, J, M, 6, NSDFT); 00033 00034 nsfft_init_random_nodes_coeffs(&p); 00035 00036 nfft_vpr_complex(p.f_hat, K, "frequencies, vector f_hat (first few entries)"); 00037 00039 nsfft_trafo_direct(&p); 00040 nfft_vpr_complex(p.f, K, "nsdft, vector f (first few entries)"); 00041 00043 nsfft_trafo(&p); 00044 nfft_vpr_complex(p.f, K, "nsfft, vector f (first few entries)"); 00045 00047 nsfft_adjoint_direct(&p); 00048 nfft_vpr_complex(p.f_hat, K, "adjoint nsdft, vector f_hat, (first few entries)"); 00049 00051 nsfft_adjoint(&p); 00052 nfft_vpr_complex(p.f_hat, K, "adjoint nsfft, vector f_hat, (first few entries)"); 00053 00055 nsfft_finalize(&p); 00056 } 00057 00058 int main(int argc,char **argv) 00059 { 00060 int d, J, M; 00061 00062 system("clear"); 00063 printf("1) computing a two dimensional nsdft, nsfft and adjoints\n\n"); 00064 d=2; 00065 J=5; 00066 M=(J+4)*nfft_exp2i(J+1); 00067 simple_test_nsfft(d,J,M); 00068 getc(stdin); 00069 00070 system("clear"); 00071 printf("2) computing a three dimensional nsdft, nsfft and adjoints\n\n"); 00072 d=3; 00073 J=5; 00074 M=6*nfft_exp2i(J)*(nfft_exp2i((J+1)/2+1)-1)+nfft_exp2i(3*(J/2+1)); 00075 simple_test_nsfft(d,J,M); 00076 00077 return 1; 00078 }