Goal
After this appendix you can rerun every plot and every number quoted in the notes, and you know which script and which model stands behind each simulator on the website.
Every data plot in these notes comes from a short Python script in the folder code/ of the course repository. Every interactive simulator on the website is a TypeScript port of one of these scripts, and its unit tests compare it with numbers the script stores. The question this appendix answers is: where does each number come from, and how much should you trust it?
The scripts need only numpy, scipy and matplotlib. Each one starts by calling a memory guard, which caps the process’s address space so that a careless parameter choice fails fast instead of freezing the machine. Each one writes its plots twice (a PDF for the book, a PNG for the website) and records its key numbers in code/reference-values.json.
Running the code
python3 code/run_all.py # every plot and number, about 2 minutes
python3 code/zeno_basics.py # Modules 1-2
python3 code/ring_transfer.py # Modules 5-6
python3 code/cnot_add_drop.py # Modules 8-10 (--check: dt test)
python3 code/paper_b_blockade.py # Module 11
python3 code/mis_anneal.py # Modules 12-13What each script computes
| Script | Model | Method | Modules |
|---|---|---|---|
zeno_basics.py | Rabi flopping with | closed form; exact exponential of the 16-dim Liouvillian | 1, 2 |
ring_transfer.py | add-drop transfer functions, dressed ring with a pump photon | closed form | 5, 6 |
cnot_add_drop.py | Paper A two-photon model (signal, pump, SF) | collision model with exchange angles | 8, 9, 10 |
paper_b_blockade.py | driven mode with TPA or lossy SFG | sparse Liouvillian, Krylov exponential | 11 |
mis_anneal.py | Zeno-constrained annealing on small graphs | Kraus maps of the full constraint gadget | 12, 13 |
Paper A: the collision model
The draft solves its real-space equations on a grid. The course code uses an equivalent discrete picture, derived in Module 9: time is cut into bins of length
for each time step:
1. signal exchanges with its buses (pump far away: pump index fixed)
2. pump exchanges with its bus (signal far away: signal index fixed)
3. the 8-state cluster with both photons (or the SF photon) at the ring:
bus bins + ring modes + SFG coupling, one exp(-i H dt)Because each block is unitary, the norm is conserved to
Paper B: the Liouvillian and the Kraus maps
For one mode, paper_b_blockade.py keeps the Fock states mis_anneal.py builds the constraint gadget of Paper B Eq. (34) from its parts (beamsplitter, SFG, pump phase, SFG, inverse beamsplitter) in a 36-state space of two signal modes and two pump modes, traces out the pump modes to obtain Kraus operators on the qubit pair, and applies them edge by edge.
Reproduced numbers
| Quantity | Source value | Course value | Script |
|---|---|---|---|
| survival after | zeno_basics.py | ||
| Paper A | cnot_add_drop.py | ||
| Paper A | cnot_add_drop.py | ||
| Paper A SF leakage | cnot_add_drop.py | ||
| Paper A drop-port delay | cnot_add_drop.py | ||
| Paper A | cnot_add_drop.py | ||
| Paper B coherent SFG, 99% success | paper_b_blockade.py | ||
| Paper B critically damped SFG, 99% | above TPA | paper_b_blockade.py | |
| Paper B TPA, 99% success | paper_b_blockade.py | ||
| Paper B 5-node MIS, coherent, 1000 cycles | close to ideal | mis_anneal.py | |
| Paper B 5-node MIS, incoherent | much lower | mis_anneal.py |
The Paper A gaps have known causes. The
Common trap: trusting a smooth curve
A finite Fock cutoff or a coarse time step gives smooth, plausible curves that are wrong. Each script has a check: the collision model reports its norm error and runs at two time steps (
--check); the Liouvillian runs usefor , where more photons are excited, and above; the corrected closed form for the lossy pump (Paper B Eqs. (51) to (53), corrected) agrees with the numerics to .
The website simulators
| Simulator | Port of | Tested against |
|---|---|---|
zeno-measurement | zeno_basics.py, staircase | survival at |
three-level-blockade | zeno_basics.py, three-level model | |
ring-transfer | ring_transfer.py | dressed and imbalanced through-port transmission |
add-drop-cnot | cnot_add_drop.py (coarser time step) | |
sfg-blockade | paper_b_blockade.py | success at |
hom-constraint | mis_anneal.py, gadget | |
mis-anneal | mis_anneal.py, anneal | 3-node success at 100 cycles |
The simulators integrate open systems with a fourth-order Runge-Kutta step no longer than one fifth of the inverse of the largest rate, which reproduces the exact exponentials to about
What breaks
The models are reduced. The Paper A code treats one transverse mode per frequency, no intrinsic loss in the ring unless set, and no dispersion; the Paper B code keeps a few photons per mode and small graphs (at most 5 vertices on the website). Use them to understand trends and to check the papers’ numbers, not to design a device.
Why it matters
Every number in the notes can be regenerated in a few minutes, and every disagreement with the papers is either explained (pulse-width convention, factor of two in Paper B Section 2.2, corrected Eqs. (51) and (53)) or listed as open in Appendix C.