1% Copyright (c) 2002, 2017 Jens Keiner, Stefan Kunis, Daniel Potts
2%
3% This program is free software; you can redistribute it and/or modify it under
4% the terms of the GNU General Public License as published by the Free Software
5% Foundation; either version 2 of the License, or (at your option) any later
6% version.
7%
8% This program is distributed in the hope that it will be useful, but WITHOUT
9% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10% FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
11% details.
12%
13% You should have received a copy of the GNU General Public License along with
14% this program; if not, write to the Free Software Foundation, Inc., 51
15% Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16N=64;
17T=3*N; %T=5*N/2;
18R=3*N/2;
19
20
21f=fft2(phantom(N));
22%f=imresize(im2double(imread('trui.png')),N/256);
23fr=real(f); fi=imag(f);
24save 'input_data_r.dat' fr -ascii -double
25save 'input_data_i.dat' fi -ascii -double
26
27
28if ispc
29    cmd='polar_fft_test.exe';
30else
31    cmd='./polar_fft_test';
32end
33system(sprintf('%s %d %d %d',cmd,N,T,R));
34
35polar_fft_error = load('polar_fft_error.dat');
36polar_ifft_error3 = load('polar_ifft_error3.dat');
37polar_ifft_error6 = load('polar_ifft_error6.dat');
38polar_ifft_error9 = load('polar_ifft_error9.dat');
39
40figure(1);
41h=semilogy(1:length(polar_fft_error),polar_fft_error);
42set(h,'LineWidth',2.0); set(h,'Markersize',10);
43set(gca,'FontSize',22);
44grid;
45axis([0,10,10^-15,1]);
46title('Test of the polar FFT');
47xlabel('m');
48ylabel('E_{max}');
49print fig_polar_fft -deps2
50
51figure(2);
52it=0:10:100;
53h=plot(it,polar_ifft_error3,'-',it,polar_ifft_error6,'--',it,polar_ifft_error9,'-.');
54set(h,'LineWidth',2.0); set(h,'Markersize',10);
55set(gca,'FontSize',22);
56grid;
57title('Test of the inverse polar FFT');
58xlabel('iterations');
59ylabel('E_{max}');
60legend('m=3','m=6','m=9');
61print fig_ipolar_fft -deps2
62
63disp(sprintf('\n'));
64
65
66if ispc
67    cmd_mpolar_fft_test='mpolar_fft_test.exe';
68else
69    cmd_mpolar_fft_test='./mpolar_fft_test';
70end
71system(sprintf('%s %d %d %d',cmd_mpolar_fft_test,N,T,R));
72
73mpolar_fft_error = load('mpolar_fft_error.dat');
74mpolar_ifft_error3 = load('mpolar_ifft_error3.dat');
75mpolar_ifft_error6 = load('mpolar_ifft_error6.dat');
76mpolar_ifft_error9 = load('mpolar_ifft_error9.dat');
77
78figure(3);
79h=semilogy(1:length(mpolar_fft_error),mpolar_fft_error);
80set(h,'LineWidth',2.0); set(h,'Markersize',10);
81set(gca,'FontSize',22);
82grid;
83axis([0,10,10^-15,1]);
84title('Test of the mpolar FFT');
85xlabel('m');
86ylabel('E_{max}');
87print fig_mpolar_fft -deps2
88
89figure(4);
90it=0:2:20;
91h=semilogy(it,mpolar_ifft_error3,'-',it,mpolar_ifft_error6,'--',it,mpolar_ifft_error9,'-.');
92set(h,'LineWidth',2.0); set(h,'Markersize',10);
93set(gca,'FontSize',22);
94grid;
95title('Test of the inverse mpolar FFT');
96xlabel('iterations');
97ylabel('E_{max}');
98legend('m=3','m=6','m=9');
99print fig_impolar_fft -deps2
100
101disp(sprintf('\n'));
102
103
104if ispc
105    cmd_linogram_fft_test='linogram_fft_test.exe';
106else
107    cmd_linogram_fft_test='./linogram_fft_test';
108end
109system(sprintf('%s %d %d %d',cmd_linogram_fft_test,N,T,R));
110
111linogram_fft_error = load('linogram_fft_error.dat');
112linogram_ifft_error3 = load('linogram_ifft_error3.dat');
113linogram_ifft_error6 = load('linogram_ifft_error6.dat');
114linogram_ifft_error9 = load('linogram_ifft_error9.dat');
115
116figure(5);
117h=semilogy(1:length(linogram_fft_error),linogram_fft_error);
118set(h,'LineWidth',2.0); set(h,'Markersize',10);
119set(gca,'FontSize',22);
120grid;
121axis([0,10,10^-15,1]);
122title('Test of the linogram FFT');
123xlabel('m');
124ylabel('E_{max}');
125print fig_lino_fft -deps2
126
127figure(6);
128it=0:2:20;
129h=semilogy(it,linogram_ifft_error3,'-',it,linogram_ifft_error6,'--',it,linogram_ifft_error9,'-.');
130set(h,'LineWidth',2.0); set(h,'Markersize',10);
131set(gca,'FontSize',22);
132grid;
133title('Test of the inverse linogram FFT');
134xlabel('iterations');
135ylabel('E_{max}');
136legend('m=3','m=6','m=9');
137print fig_ilino_fft -deps2
138