|
27 | 27 | f=1.2; % error correction efficiency |
28 | 28 |
|
29 | 29 | 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; |
31 | 32 |
|
32 | 33 | 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 | + |
38 | 43 | % Privacy amplification compression factor |
39 | 44 | % 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 |
42 | 47 |
|
43 | 48 | % Secret key rate |
44 | | - % SKR = R_sif.*(-fe*h(qber) - tau); % 2007 analysis |
45 | 49 | 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); |
53 | 54 | end |
54 | 55 |
|
55 | 56 | end |
|
61 | 62 |
|
62 | 63 | function y = h(x) |
63 | 64 | %the binary entropy function |
64 | | - y = x.*log2(x) + (1-x).*log2(1-x); |
| 65 | + y = -(x.*log2(x) + (1-x).*log2(1-x)); |
65 | 66 | end |
0 commit comments