-
Notifications
You must be signed in to change notification settings - Fork 1
/
main_upload.m
96 lines (79 loc) · 2.01 KB
/
main_upload.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
% codes for paper
% "Fast Reconstruction of High-qubit Quantum States via Low Rate Measurements"
%
%
%
%
% Copyrights to Dr. Kezhi Li, @Imperial College, 22nd Jan. 2017
clear all
clc
qubit=9;
R=1;
%SNR=40;
switch R
case 1
disp('R = 1')
svd_sNo = 200; % adaptive parameter, keep how many singular values
shrink_para = 1; % is the no. of singular value decreasing
case 2
disp('R = 2')
svd_sNo = 150;
shrink_para = 1;
end
N=2^qubit;
P=2^qubit;
switch qubit
case 8
disp('8')
load A_8.mat;
eta = 0.03; % 3%
case 9
disp('9')
load A_9.mat;
eta = 0.017; % 1.7%
case 10
disp('10')
load A_10.mat;
eta = 9438/(N*P); % 1%
case 11
disp('11')
load A_11.mat;
eta = 25166/(N*P); % 0.6%
case 12
disp('12')
load A_12.mat;
eta = 62500/(N*P); % 0.3%
end
t=0.9; % parameter
gamma=1e-4;
lamda=15;
c=1.099;%ADMM parameter
nu=0;
tol_1=1e-6;
% generate X_true matrix, and the number of measurements M
[M,outlier,X_true]=generate_rho_outlier(N,P,R,eta,nu);
% This step generates the sensing matrix 'A'. If 'A' has been generated, we
% can load it directly.
%[A]=generate_A_withoutAA_kz1(eta,N,P,qubit,M);
% the magnitudes of noises
sigma=1e-4*norm(X_true,'fro');
% generate the measurements after corrupted by noises
b= A*(reshape(X_true,N*P,1))+sigma*randn(M,1);
% maximum iteration no.
maxite=100;
tic
% main function to reconstruct the density matrix rho
[ rho1,result_min,result_rho,result_resid,t_095,fide_095] =Robust_Quantum_fixedpoint_fast(b,A,maxite,tol_1 ,X_true,gamma,lamda,c,M,t,svd_sNo,shrink_para); % ,svd_sNo,shrink_para
T=toc;
% draw results for the correspoding qubits
xx=1:1:maxite;
figure,
plot(xx,result_rho(1,:),'r*-');
hold on
plot(xx,result_resid(1,:),'b*-');
xlabel('iteration');
ylabel('error')
title('n=');
% display the time and fidelity when 95% accuracy has been achieved
disp(t_095)
disp(fide_095)