Conventions
Enforced by the Conventions exam.
| Convention | qkd |
|---|---|
| Trust | an explicit trusted= flag, never inferred — Security |
| Unsupported combination | raises, naming the restriction; never approximated — refusals |
| Quadratures | |
| Vacuum | |
| Coherent state | mean |
| Ordering | xpxp: |
| Covariance |
from qkd import gaussian as g
g.Vacuum(1).cov
# array([[0.5, 0. ],
# [0. , 0.5]])Ordering and the symplectic form
| Symplectic form | |
| Same | the single global block |
| Gaussian unitary |
The bona fide condition
import numpy as np
V = np.diag([0.4, 0.4])
omega = np.array([[0.0, 1.0], [-1.0, 0.0]])
np.linalg.eigvalsh(V) # array([0.4, 0.4]) -- positive definite
np.linalg.eigvalsh(V + 0.5j * omega) # array([-0.1, 0.9]) -- not a state| The negative eigenvalue | |
| Applied by | State.physical(), and the test harness after every channel and every symplectic map |
| Tolerance | absolute, not scaled by the state's own energy |
| Boundary | |
| Symplectic eigenvalues |
from qkd import gaussian as g
g.Moments([0.0, 0.0], [[0.25e-6, 0.0], [0.0, 1e6]]) # accepted
g.Moments([0.0, 0.0], [[4.9e-97, 0.0], [0.0, 1e6]])
# ValueError: cov violates the bona fide condition V + i*Omega/2 >= 0The SNU boundary
| Layer | Module | Units | Vacuum |
|---|---|---|---|
| Gaussian states, channels, sampling | qkd.gaussian | internal, | |
| Number-basis states, Wigner, Husimi, negativity | qkd.fock | internal, | |
| Excess-noise budget, key rate, security | qkd.budget, qkd.Link, qkd.Swap | SNU |
State.cov, State.spectrum() and State.purity() are internal. fock.State.shadow() needs no conversion.
from qkd import gaussian as g
st = g.Coherent(1.0, 0.0).thermal_loss(0, T=0.5, xi=0.01, ref="input")
st.cov[0, 0] # 0.5025 internal
2.0 * st.cov[0, 0] # 1.005 SNU: vacuum 1 plus T*xi = 0.005| Where the factor surfaces | Form |
|---|---|
thermal_loss | multiplies the SNU xi argument by |
purity() | |
entropy() | converts |
| Bona fide, in SNU |
Reference states
| State | Internal ( | SNU (vacuum |
|---|---|---|
Vacuum(n) | ||
Coherent(x, p) | ||
Thermal(nbar) | ||
Squeezed(r) | ||
Epr(r) |
Epr at
Excess noise carries a plane
| qkd's plane | the channel input (Alice's side) everywhere, as Lodewyck, Fossier and Leverrier |
| Never defaulted | thermal_loss and q.Channel(xi=...) require ref= — see the ref= plane |
Bulk returns are numpy arrays
Bulk returns cross the PyO3 boundary as numpy.ndarray, so numpy is a hard runtime dependency. None aliases its source.
| Call | dtype | Shape | Buffer |
|---|---|---|---|
gaussian.State.mean | float64 | (2n,) | copied from the state |
gaussian.State.cov | float64 | (2n, 2n) | copied from the state, reshaped from flat |
gaussian.State.homodyne(...) | float64 | (shots,) | built for the call |
gaussian.State.heterodyne(...) | float64 | (shots, 2) | built for the call |
fock.State.populations() | float64 | (cutoff,) | built for the call |
fock.State.eigenvalues() | float64 | (cutoff,) | built for the call |
fock.State.wigner(xs, ps), .husimi(xs, ps) | float64 | (len(ps), len(xs)) | built for the call |
fock.State.matrix() | complex128 | (cutoff, cutoff) | copied from the state |
_core.SimOut.frames_x, .frames_p | float64 | (n_used,) | copied from the run |
_core.cpu_words(...), _core.gpu_words(...) | uint32 | (4n,) | built for the call |
cpu_words and gpu_words are Threefry-4×32-20 words; uint32 arithmetic wraps at
Where the literature disagrees
| Point | qkd | Alternative in the literature |
|---|---|---|
| Vacuum variance | ||
| Quadrature ordering | xpxp | xxpp |
| Plane of | channel input | channel output (Laudenbach 2018, Eq. (4.8)); divide by |
| Heterodyne 3 dB penalty | inside | |
| Entropy function |