0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 clear;
0012
0013 N_test = 3
0014
0015 B = 2;
0016 J_min = 1;
0017 spin = 0;
0018 reality = false;
0019 sampling_method = 'MW';
0020 upsample= false;
0021 save_plots = true;
0022
0023 Ls = [4 8 16 32 64]
0024
0025 err = zeros(N_test, length(Ls));
0026 time_analysis = zeros(N_test, length(Ls));
0027 time_synthesis = zeros(N_test, length(Ls));
0028
0029 el_ind = 0;
0030 for L = Ls
0031 el_ind = el_ind + 1
0032 L
0033
0034 for n = 1:N_test
0035
0036 n
0037
0038
0039 flm = zeros(L^2,1);
0040 flm = rand(size(flm)) + sqrt(-1)*rand(size(flm));
0041 flm = 2.*(flm - (1+sqrt(-1))./2);
0042
0043
0044 f = ssht_inverse(flm, L, 'Method', sampling_method);
0045
0046 tstart = tic;
0047 [f_cur, f_scal] = s2let_transform_curvelet_analysis_px2cur(f, ...
0048 'B', B, 'L', L, 'J_min', J_min, ...
0049 'Upsample', upsample, 'Spin', spin, 'Reality', reality, ...
0050 'Sampling', sampling_method);
0051 time_analysis(n, el_ind) = toc(tstart);
0052
0053 tstart = tic;
0054 f_recov = s2let_transform_curvelet_synthesis_cur2px(f_cur, f_scal, ...
0055 'L', L, 'B', B, 'J_min', J_min, ...
0056 'Upsample', upsample, 'Spin', spin, 'Reality', reality, ...
0057 'Sampling', sampling_method);
0058
0059
0060 time_synthesis(n, el_ind) = toc(tstart);
0061
0062 err(n, el_ind) = max(abs(f(:) - f_recov(:)));
0063
0064 end
0065
0066 end
0067
0068 err_mean = mean(err);
0069 err_std = std(err);
0070 err_std_log = std(log10(err));
0071
0072 time_analysis_mean = mean(time_analysis);
0073 time_analysis_std = std(time_analysis);
0074
0075
0076 time_synthesis_mean = mean(time_synthesis);
0077 time_synthesis_std = std(time_synthesis);
0078
0079
0080 time_total = time_analysis + time_synthesis;
0081 time_total_mean = mean(time_total);
0082 time_total_std = std(time_total);
0083 time_total_std_log = std(log10(time_total));
0084
0085
0086
0087 pltroot = '../../../figs/' ;
0088
0089
0090
0091 istart = 1;
0092 iend = length(Ls);
0093
0094 line_width = 1.8;
0095 line_width_thick = 2.5;
0096 marker_size = 7;
0097 marker_type = 'o';
0098 green_light = [0.2 0.6 0.4];
0099 green_dark = [0 0.4 0.2];
0100 blue_light = [0.2 0.4 0.8];
0101 blue_dark = [0 0 1];
0102 red_light = [1 0.4 0.2];
0103 red_dark = [0.8 0.2 0];
0104
0105
0106
0107 figure;
0108
0109 plot(log2(Ls(istart:iend)), ...
0110 log10(err_mean(istart:iend)), ...
0111 'Color', green_dark, ...
0112 'Marker', marker_type, ...
0113 'MarkerSize', marker_size, ...
0114 'MarkerFaceColor', green_light, ...
0115 'MarkerEdgeColor', green_dark, ...
0116 'LineStyle', '--', ...
0117 'LineWidth', line_width);
0118
0119 hold on;
0120
0121 plot(log2(Ls(istart:iend)), ...
0122 log10(Ls(istart:iend).^2)-15, ...
0123 'r', ...
0124 'LineWidth', line_width_thick);
0125
0126 a = axis;
0127 set(gca,'XTick',a(1):1:a(2));
0128 set(gca,'XTickLabel', 2.^[a(1):1:a(2)]);
0129 set(gca,'YTick',floor(a(3)):1:ceil(a(4)));
0130 set(gca,'YTickLabel',{10.^[floor(a(3)):ceil(a(4))]});
0131 xlabel('$L$','Interpreter','LaTex');
0132 ylabel('Maximum error');
0133
0134 set(gca, 'LineWidth', 3)
0135 set(gca, 'FontSize', 20)
0136 xt =get(gca,'XTick');
0137 set(gca, 'FontSize', 18);
0138
0139 fname = [pltroot,'curvelet_error.png']
0140 print('-r200', '-dpng', fname);
0141
0142
0143
0144
0145 figure
0146
0147 errorbar(log2(Ls(istart:iend)), ...
0148 log10(err_mean(istart:iend)), ...
0149 err_std_log(istart:iend), ...
0150 'Color', green_dark, ...
0151 'Marker', marker_type, ...
0152 'MarkerSize', marker_size, ...
0153 'MarkerFaceColor', green_light, ...
0154 'MarkerEdgeColor', green_dark, ...
0155 'LineStyle', '--', ...
0156 'LineWidth', line_width);
0157
0158 hold on;
0159
0160 plot(log2(Ls(istart:iend)), ...
0161 log10(Ls(istart:iend).^2)-15, ...
0162 'r', ...
0163 'LineWidth', line_width_thick);
0164
0165 a = axis;
0166 set(gca,'XTick',a(1):1:a(2));
0167 set(gca,'XTickLabel', 2.^[a(1):1:a(2)]);
0168 set(gca,'YTick',floor(a(3)):1:ceil(a(4)));
0169 set(gca,'YTickLabel',{10.^[floor(a(3)):ceil(a(4))]});
0170 xlabel('$L$','Interpreter','LaTex');
0171 ylabel('Maximum error','Interpreter','LaTex');
0172
0173
0174 set(gca, 'LineWidth', 3)
0175 set(gca, 'FontSize', 20)
0176
0177 fname = [pltroot,'curvelet_errorbar.png']
0178 print('-r200', '-dpng', fname);
0179
0180
0181
0182
0183 figure;
0184
0185 plot(log2(Ls(istart:iend)), ...
0186 log10(time_total_mean(istart:iend)), ...
0187 'Color', green_dark, ...
0188 'Marker', marker_type, ...
0189 'MarkerSize', marker_size, ...
0190 'MarkerFaceColor', green_light, ...
0191 'MarkerEdgeColor', green_dark, ...
0192 'LineStyle', '--', ...
0193 'LineWidth', line_width);
0194
0195 hold on;
0196
0197
0198 plot(log2(Ls(istart:iend)), ...
0199 log10((Ls(istart:iend).^3).*log2(Ls(istart:iend)))-2,...
0200 'r', ...
0201 'LineWidth', line_width_thick);
0202 a = axis;
0203 set(gca,'XTick',a(1):1:a(2));
0204 set(gca,'XTickLabel', 2.^[a(1):1:a(2)]);
0205 set(gca,'YTick',floor(a(3)):1:ceil(a(4)));
0206 set(gca,'YTickLabel',{10.^[floor(a(3)):ceil(a(4))]});
0207 xlabel('$L$','Interpreter','LaTex');
0208 ylabel('Computation time (s)');
0209
0210 set(gca, 'LineWidth', 3)
0211 set(gca,'FontSize', 20)
0212
0213 fname = [pltroot,'curvelet_timing.png']
0214 print('-r200', '-dpng', fname);
0215
0216
0217 figure;
0218
0219 errorbar(log2(Ls(istart:iend)), ...
0220 log10(time_total_mean(istart:iend)), ...
0221 time_total_std_log(istart:iend), ...
0222 'Color', green_dark, ...
0223 'Marker', marker_type, ...
0224 'MarkerSize', marker_size, ...
0225 'MarkerFaceColor', green_light, ...
0226 'MarkerEdgeColor', green_dark, ...
0227 'LineStyle', '--', ...
0228 'LineWidth', line_width);
0229
0230 hold on;
0231
0232
0233 plot(log2(Ls(istart:iend)), ...
0234 log10((Ls(istart:iend).^3).*log2(Ls(istart:iend)))-2,...
0235 'r', ...
0236 'LineWidth', line_width_thick);
0237 a = axis;
0238 set(gca,'XTick',a(1):1:a(2));
0239 set(gca,'XTickLabel', 2.^[a(1):1:a(2)]);
0240 set(gca,'YTick',floor(a(3)):1:ceil(a(4)));
0241 set(gca,'YTickLabel',{10.^[floor(a(3)):ceil(a(4))]});
0242 xlabel('$L$','Interpreter','LaTex');
0243 ylabel('Computation time (s)','Interpreter','LaTex');
0244
0245 set(gca, 'LineWidth', 3)
0246 set(gca,'FontSize', 20)
0247
0248 fname = [pltroot,'curvelet_timing_errorbar.png']
0249 print('-r200', '-dpng', fname);
0250