-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtimeGraphTomo.m
44 lines (33 loc) · 1.48 KB
/
timeGraphTomo.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
%This example simulates measurements made on a randomly generated density
%matrix and applies the PGDM method (the unkown-r version). One can change
%the parameters of the simulations (dimensionality, purity, number of
%clicks, type of measurement), but the current version uses
%a qubit SIC-POVM on a four-qubit 0.5 purity system with 10000 counts per
%outcome on average.
function [fid,timeTaken] = timeGraphTomo(param,A)
% [rho, A, data] = generateDataset(param);
%%% if the entropy is needed uncomment the following line (comp. intensive)
% figure(222);semilogy(1,1);hold on
r = param.counts; %add as third input to fullTomography if known
%%%%%% if you have data of your own, the following lines are useful %%%%%%%
[rho, data] = generateDataset(param,A);
[rhoEstimates, timeTaken, costs] = fullTomography(data,A,r); %note that 'r' is optional here.
% close all
% figure(222); hold off
%calculate fidelities and plot log likelihoods as a function of iteration
fields = fieldnames(costs);
fields2 = fieldnames(timeTaken);
for i = 1:numel(fields2)
fid.(fields2{i}) = fidelityRho(rho,rhoEstimates.(fields2{i}));
end
for i = 1:numel(fields)
semilogy(costs.(fields{i}),'-'); hold on
% legend222{i} = fields{i};
end
% legend(legend222)
% grid on
% disp(' ')
% disp('The time taken by each method in seconds is')
% disp(timeTaken)
% disp('The fidelity between the actual state ''rho'' and the maximum likelihood state ''rhoEstimate'' is:')
% disp(fid)