-
Notifications
You must be signed in to change notification settings - Fork 4
/
skyscraper_movie.m
125 lines (91 loc) · 2.57 KB
/
skyscraper_movie.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
d = 4;
% choi_ground = randomCPTP_quasi_pure(d,0.9);
choi_ground = randomCPTP(d,d*d);
choi_ground_vec = reshape(choi_ground,[],1);
A = PM_minimal(d);
p = real(A*choi_ground_vec);
n = p; % noiseless scenario
[choi_ml_vec, solution, costs] = gdapB(A,n);
v = VideoWriter('./plots/movies/FULLRANKss.avi');
open(v)
for o=1:floor(length(solution)/3)
choi_ml_vec = solution{o}
choi_ml = reshape(choi_ml_vec,[],d*d);
error = trace_dist(choi_ground/trace(choi_ground),choi_ml/trace(choi_ml))
figure('Position',[1 0 1300 1300]);
subplot(2,2,1)
b1 = bar3(real(choi_ground));
title('Ground truth (Real)')
for k = 1:length(b1)
zdata = b1(k).ZData;
b1(k).CData = zdata;
b1(k).FaceColor = 'interp';
end
xlabel('i')
ylabel('j')
xticks([1,d*d/2,d*d])
yticks([1,d*d/2,d*d])
ylim([0,d*d+0.5])
xlim([0,d*d+0.5])
zlim([-1,1])
zlabel('Re$C_{\mathcal{E}}$','Interpreter','latex')
set(gca,'fontsize',18)
subplot(2,2,3)
b3 = bar3(real(choi_ml));
title(['Estimate (Real) k = ',num2str(o)])
for k = 1:length(b3)
zdata = b3(k).ZData;
b3(k).CData = zdata;
b3(k).FaceColor = 'interp';
end
xlabel('i')
ylabel('j')
xticks([1,d*d/2,d*d])
yticks([1,d*d/2,d*d])
ylim([0,d*d+0.5])
xlim([0,d*d+0.5])
zlim([-1,1])
zlabel('Re$C_{\mathcal{E}}$','Interpreter','latex')
set(gca,'fontsize',18)
subplot(2,2,2)
b2 = bar3(imag(choi_ground));
title('Ground truth (Imag)')
for k = 1:length(b2)
zdata = b2(k).ZData;
b2(k).CData = zdata;
b2(k).FaceColor = 'interp';
end
xlabel('i')
ylabel('j')
xticks([1,d*d/2,d*d])
yticks([1,d*d/2,d*d])
ylim([0,d*d+0.5])
xlim([0,d*d+0.5])
zlim([-1,1])
zlabel('Im$C_{\mathcal{E}}$','Interpreter','latex')
set(gca,'fontsize',18)
subplot(2,2,4)
b4 = bar3(imag(choi_ml));
title(['Estimate (Imag) error = ',num2str(error)])
for k = 1:length(b4)
zdata = b4(k).ZData;
b4(k).CData = zdata;
b4(k).FaceColor = 'interp';
end
xlabel('i')
ylabel('j')
xticks([1,d*d/2,d*d])
yticks([1,d*d/2,d*d])
ylim([0,d*d+0.5])
xlim([0,d*d+0.5])
zlim([-1,1])
zlabel('Im$C_{\mathcal{E}}$','Interpreter','latex')
set(gca,'fontsize',18)
F=getframe(gcf);
writeVideo(v,F)
writeVideo(v,F) % write same frame 2 times
% saveas(gcf,'./plots/movies/ss.png')
close
% saveas(gcf,'./plots/ss.eps','epsc')
end
close(v)