-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathgenerate_clicks.m
72 lines (56 loc) · 1.76 KB
/
generate_clicks.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
% script to generate a number of simulated datasets
%% check global variable set
if exist('ensemble')
fprintf(['ensemble = ',ensemble])
else
error('you must set the ensemble variable to either qp (quasi pure) or fr (full rank)')
end
if exist('drange')
fprintf(['drange = ',drange])
else
error('you must set the drange variable')
end
if exist('LIswitch')
fprintf(['LIswitch = ',LIswitch])
else
error('you must set the LIsiwtch variable (if 0 Linear Inversion is run, if 1 it is not)')
end
if exist('ensemble_size')
fprintf(['ensemble_size = ',ensemble_size])
else
error('you must set the ensemble_size variable')
end
%%
for d=drange
dir = sprintf('./benchmarking_results/d%i',d);
fprintf(char(10));
fprintf('%d ', d);
A = PM_minimal(d);
% A = GGMall_IO(d);
% precompute matrices for TP_project
M = zeros([d*d,d*d*d*d]);
for i=1:d
e = zeros(1,d);
e(i) = 1;
B = kron(eye(d),e);
M = M + kron(B,B);
end
MdagM = sparse(M'*M);
b = sparse(reshape(speye(d),[],1));
Mdagb = sparse(M'*b);
for i=1:ensemble_size
fprintf('%d ', i);
% generate random ground truth
switch ensemble
case 'qp'
choi_ground = randomCPTP_quasi_pure(d,0.9);
% choi_ground = randomCPTP(d,1); % kraus rank 1, i.e unitary map.
case 'fr'
choi_ground = randomCPTP(d,d*d); % kraus rank is full.
end
choi_ground_vec = reshape(choi_ground,[],1);
p = real(A*choi_ground_vec);
n = p; % noiseless scenario
save([dir,'/dataset',num2str(i)],'choi_ground','n','p')
end
end