-
Notifications
You must be signed in to change notification settings - Fork 2
/
plot_saylr3.m
81 lines (69 loc) · 2.37 KB
/
plot_saylr3.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
function plot_saylr3()
clear all
A = load('data/saylr3.mat');
A = A.Problem.A;
%% mix precision
u1 = precision('d');
u2 = precision('s');
u3 = precision('h');
u4 = precision('b');
u5 = precision('q52');
u_chain = prec_chain(u1, u2, u3, u4, u5);
epsilon = 1e-4; % 1e-1
depth = 6;
aphA = amphodlr(u_chain, A, depth, 10, 'svd', epsilon);
aprA = recover(aphA);
%disp(aphA);
%disp(epsilon);
%disp(norm(aprA - A, 'fro') / norm(A, 'fro'));
bound_err = (2 * sqrt(2 * aphA.bottom_level) + 1) * epsilon;
% disp(bound_err);
figure()
pA = compute_hmat_prec(aphA);
h = heatmap(pA,'CellLabelColor','none');
h.ColorbarVisible = 'off';
h.GridVisible = 'off';
h.Colormap = spring;
set(gcf, 'Position', [10 10 700 600])
Ax = gca;
Ax.XDisplayLabels = nan(size(Ax.XDisplayData));
Ax.YDisplayLabels = nan(size(Ax.YDisplayData));
exportgraphics(gca,'figures/precssaylr3.pdf')
nA = compute_hmat_norm(aphA);
h = heatmap(nA,'CellLabelColor','none');
h.FontSize = 17;
h.Colormap = cool(4);
h.GridVisible = 'off';
set(gcf, 'Position', [10 10 700 600])
Ax = gca;
Ax.XDisplayLabels = nan(size(Ax.XDisplayData));
Ax.YDisplayLabels = nan(size(Ax.YDisplayData));
exportgraphics(gca, 'figures/normsaylr3.pdf')
% gca = plot_hmat_nprec(aphA);
% exportgraphics(h, 'figures/pnormLeGres.pdf')
data = compute_hmat_norm(aphA);
pA = compute_hmat_prec(aphA);
% h = heatmap(nA);
ColorMap = cool(4);
[m, n] = size(data);
fig = figure('Renderer', 'painters', 'Position', [10 10 750 600]);
ax = axes(fig);
h = imagesc(ax, data);
set(ax,'XTick',1:m,'YTick',1:n);
% title('imagesc')
ax.TickLength(1) = 0;
% Create heatmap's colormap
cmap = ColorMap; % [linspace(.9,0,n)', linspace(.9447,.447,n)', linspace(.9741,.741,n)'];
h2 = colormap(ax, cmap);
h3 = colorbar(ax);
hold on
% Set grid lines
% arrayfun(@(x)xline(ax,x,'k-','Alpha',1),0.5:1:(m+.5));
% arrayfun(@(y)yline(ax,y,'k-','Alpha',1),0.5:1:(n+.5));
[linesF, columnsF, valuesF] = find(pA);
% th = text(linesF, columnsF, string(valuesF), ...
% 'VerticalAlignment', 'middle','HorizontalAlignment','Center');
fontsize(9,"points");
hold off
exportgraphics(gca, 'figures/pnormsaylr3.pdf');
end