Skip to content

Conventions ​

Enforced by the Conventions exam.

Conventionqkd
Trustan explicit trusted= flag, never inferred — Security
Unsupported combinationraises, naming the restriction; never approximated — refusals
ℏ1
Quadraturesx^=(a^+a^†)/2, p^=(a^−a^†)/(i2), so [x^,p^]=i
VacuumΔxvac2=Δpvac2=12, covariance 121
Coherent state αmean (2Reα, 2Imα)
Orderingxpxp: r^=(x^1,p^1,…,x^N,p^N)⊤, mode m at indices 2m, 2m+1
CovarianceVij=12⟨{Δr^i,Δr^j}⟩
python
from qkd import gaussian as g

g.Vacuum(1).cov
# array([[0.5, 0. ],
#        [0. , 0.5]])

Ordering and the symplectic form ​

Symplectic formΩ=1N⊗(01−10), block-diagonal in xpxp
Same Ω in xxppthe single global block (01N−1N0)
Gaussian unitaryV↦SVS⊤, r¯↦Sr¯, with SΩS⊤=Ω

The bona fide condition ​

V+i2Ω⪰0, strictly stronger than symmetry plus positive-definiteness:

python
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Δx2Δp2≥1/4 violated, 0.4×0.4=0.16
Applied byState.physical(), and the test harness after every channel and every symplectic map
Toleranceabsolute, not scaled by the state's own energy
BoundaryVxxVpp=1/4 accepted, out to Vpp=106
Symplectic eigenvaluesνk≥1/2 (internal units), =1/2 for every mode iff the state is pure
python
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 >= 0

The SNU boundary ​

VSNU=2Vinternal, applied once, between the Gaussian layer and the key-rate layer.

LayerModuleUnitsVacuum
Gaussian states, channels, samplingqkd.gaussianinternal, ℏ=11/2
Number-basis states, Wigner, Husimi, negativityqkd.fockinternal, ℏ=11/2
Excess-noise budget, key rate, securityqkd.budget, qkd.Link, qkd.SwapSNU1

VA, ξ, vel, χline and every published anchor are SNU; State.cov, State.spectrum() and State.purity() are internal. fock.State.shadow() needs no conversion.

python
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 surfacesForm
thermal_lossmultiplies the SNU xi argument by 0.5 on the way in
purity()μ=1/(2ndetV) internally versus 1/detVSNU
entropy()converts νSNU=2ν before applying G
Bona fide, in SNUV+iΩ⪰0, and Δx2Δp2≥1

Reference states ​

StateInternal (ℏ=1, vacuum 12)SNU (vacuum 1)
Vacuum(n)1212n12n
Coherent(x, p)1212, mean (x,p)12
Thermal(nbar)(n¯+12)12(2n¯+1)12
Squeezed(r)12diag(e−2r,e+2r)diag(e−2r,e+2r)
Epr(r)12(cosh⁡2r12sinh⁡2rσzsinh⁡2rσzcosh⁡2r12)(V12V2−1σzV2−1σzV12), V=cosh⁡2r

σz=diag(1,−1). The key-rate layer builds the SNU Epr at V=VA+1: Gaussian-modulated coherent states are equivalent to Alice holding half of a two-mode squeezed vacuum.

Excess noise carries a plane ​

ξBob=TξAlice.

qkd's planethe channel input (Alice's side) everywhere, as Lodewyck, Fossier and Leverrier
Never defaultedthermal_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.

CalldtypeShapeBuffer
gaussian.State.meanfloat64(2n,)copied from the state
gaussian.State.covfloat64(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_pfloat64(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 232. A dtype is the representation, not the precision computed at — see dispatch on precision, not device.

Where the literature disagrees ​

PointqkdAlternative in the literature
Vacuum variance1/2 internally, 1 in the QKD layerℏ=2 conventions put it at 1 throughout
Quadrature orderingxpxpxxpp
Plane of ξchannel inputchannel output (Laudenbach 2018, Eq. (4.8)); divide by T on import
Heterodyne 3 dB penaltyinside χhet (Lodewyck/Fossier)T→T/2, ξ→ξ/2 per quadrature (Laudenbach Eq. (5.10))
Entropy functionG(x)=(x+1)log2⁡(x+1)−xlog2⁡x at (ν−1)/2g(ν) applied to ν directly; identical, g(ν)=G((ν−1)/2)