19 double Stats::BB84Rate()
21 double R01 = p0a - .5;
22 double R23 = p1a - .5;
23 double R02 = pa0 - .5*(1-p01+p10);
26 double I01 = p0b - .5;
27 double I23 = p1b - .5;
28 double I02 = .5*(1-p01+p10) - pb0;
31 double R03 = 1 - Qx - Qy - .5*(R01+R23+I01+I23);
32 double R12 = Qy - Qx + .5*(I01+I23-R01-R23);
34 double l01 = .5 + sqrt( (p10-p01)*(p10-p01) + 4*R03*R03 ) / (2.0*(2-p01-p10));
35 double l23 = .5 + sqrt( (p01-p10)*(p01-p10) + 4*R12*R12 ) / (2.0*(p01+p10));
37 double first = entropy( (1-p01) / (2.0-p01-p10) ) - entropy(l01);
38 double second = entropy( p01 / (p01+p10) ) - entropy(l23);
40 if(p01+p10 <= .0000001)
42 if(2.0-p01-p10 <= 0.0000001)
45 double SAE = (2-p01-p10)/2.0 * first + (p01+p10)/2.0 * second;
47 double key00 = .5*(1-p01);
48 double key11 = .5*(1-p10);
49 double key01 = .5*p01;
50 double key10 = .5*p10;
52 double H = HAB(key00,key01,key10,key11);
57 void Stats::symmetric(
double Q)