Skip to content

Commit 23b4e1d

Browse files
author
Cameron Simmons
committed
Update time-phase protocols
remove prints from COW protocol and make DPS conform to inputs
1 parent 8cbb8bf commit 23b4e1d

File tree

2 files changed

+19
-21
lines changed

2 files changed

+19
-21
lines changed

+protocol/cow.m

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,12 @@
2222

2323
%% written by Alfonso Tello Castillo - based on:
2424
% Chip-based quantum key distribution P. Sibson, C. Erven, M. Godfrey et al.
25-
%altered by Cameron Simmons
25+
% altered by Cameron Simmons
2626
% further altered by Peter Barrow
2727

2828
MPN = Alice.Source.MPN_Signal;
2929
State_Prep_Error = Alice.Source.State_Prep_Error;
3030
rep_rate = Alice.Source.Repetition_Rate;
31-
%decoy_prob = Alice.Source.State_Probabilities(2);
3231
decoy_prob = Alice.Source.Probability_Decoy;
3332
Dead_Time = Bob.Detector.Dead_Time;
3433

@@ -74,8 +73,6 @@
7473

7574
% Utils functions
7675
function [V_] = eps(mu,V)
77-
size(mu)
78-
size(V)
7976
V_ = (2 .* V - 1).*exp(-mu) - 2.*sqrt(V.*(1 - V)).*sqrt(1 - exp(-2*mu));
8077
end
8178

+protocol/dps.m

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,29 +27,30 @@
2727
f=1.2; % error correction efficiency
2828

2929
T = total_loss * eta;
30-
sifted_rate = rep_rate *(mu * T + prob_dark_counts);
30+
sifted_prob = (mu * T + prob_dark_counts);
31+
sifted_rate = rep_rate *sifted_prob;
3132

3233
qber_Visibility = (1 - V)/2;
33-
qber_dark = 0.5 * prob_dark_counts;
34-
qber_encoding = 0.012;
35-
36-
qber = min(qber_dark + qber_encoding + qber_Visibility, 0.5);
37-
34+
qber_dark = 0.5 * prob_dark_counts./sifted_prob;
35+
qber_encoding = Alice.Source.State_Prep_Error;
36+
37+
%qbers add in inverse, so...
38+
%compute probability of no errors
39+
qnber = (1-qber_dark) * (1-qber_encoding) * (1-qber_Visibility);
40+
%then reverse into qber
41+
qber = 1-qnber;
42+
3843
% Privacy amplification compression factor
3944
% tau = (1 - 2*mu)*log2(1 - qber.^2 - (1 - 6*qber).^2/2); % 2007 formula
40-
tau = qber + (1 - qber).*h((1 + eps(mu, V)/2)); % 2008 formula
41-
% tau = h((3 + sqrt(5))*qber); % 2009 formula
45+
tau = qber + (1 - qber).*h((1 + eps(mu, V))/2); % 2008 formula
46+
%tau = h((3 + sqrt(5))*qber); % 2009 formula
4247

4348
% Secret key rate
44-
% SKR = R_sif.*(-fe*h(qber) - tau); % 2007 analysis
4549
secret_rate = sifted_rate.*(1 -f*h(qber) - real(tau)); % 2008 and 2009 analysis
46-
47-
%{
48-
if point
49-
tau = qberp + (1 - qberp).*h((1 + eps(mu, Vp)/2));
50-
SKRp = siftedP.*(1 -fe*h(qberp) - real(tau));
51-
end
52-
%}
50+
%skr must be nonnegative and real
51+
secret_rate(secret_rate<0&imag(secret_rate)==0)=0;
52+
%make skr real for plotting
53+
secret_rate=real(secret_rate);
5354
end
5455

5556
end
@@ -61,5 +62,5 @@
6162

6263
function y = h(x)
6364
%the binary entropy function
64-
y = x.*log2(x) + (1-x).*log2(1-x);
65+
y = -(x.*log2(x) + (1-x).*log2(1-x));
6566
end

0 commit comments

Comments
 (0)