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-13

What each script computes

ScriptModelMethodModules
zeno_basics.pyRabi flopping with measurements; three-level model with decayclosed form; exact exponential of the 16-dim Liouvillian1, 2
ring_transfer.pyadd-drop transfer functions, dressed ring with a pump photonclosed form5, 6
cnot_add_drop.pyPaper A two-photon model (signal, pump, SF)collision model with exchange angles8, 9, 10
paper_b_blockade.pydriven mode with TPA or lossy SFGsparse Liouvillian, Krylov exponential11
mis_anneal.pyZeno-constrained annealing on small graphsKraus maps of the full constraint gadget12, 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 , each bus carries one time bin past the ring per step, and in each step the ring exchanges amplitude with the bin at the coupler through a rotation by the exchange angle , with . With several buses the angle is shared as . The two-photon amplitude is stored as a table indexed by where the signal is (input bin, ring, through-port bin, drop-port bin) and where the pump is. One step applies three exact unitaries:

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 ; the only error is the time step, and halving from to changes by less than .

Paper B: the Liouvillian and the Kraus maps

For one mode, paper_b_blockade.py keeps the Fock states with (SFG conserves ; drive and loss only move within or below this ladder), builds the Lindblad generator as a matrix acting on the vectorized density matrix, and exponentiates it. For annealing, 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

QuantitySource valueCourse valueScript
survival after measurementszeno_basics.py
Paper A (pump absent, flip)cnot_add_drop.py
Paper A (pump present)cnot_add_drop.py
Paper A SF leakagecnot_add_drop.py
Paper A drop-port delaycnot_add_drop.py
Paper A at coupling ratio 2cnot_add_drop.py
Paper B coherent SFG, 99% successpaper_b_blockade.py
Paper B critically damped SFG, 99%above TPApaper_b_blockade.py
Paper B TPA, 99% successpaper_b_blockade.py
Paper B 5-node MIS, coherent, 1000 cyclesclose to ideal (ideal )mis_anneal.py
Paper B 5-node MIS, incoherentmuch lowermis_anneal.py

The Paper A gaps have known causes. The value depends on reading “164 ns” as the full width at half maximum of the amplitude; with the intensity convention it would be . The gap of about comes from the pump-feed convention, which the draft does not state fully. Both points are in Appendix C.

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 use for , 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

SimulatorPort ofTested against
zeno-measurementzeno_basics.py, staircasesurvival at
three-level-blockadezeno_basics.py, three-level model in the Rabi, coherent and incoherent cases
ring-transferring_transfer.pydressed and imbalanced through-port transmission
add-drop-cnotcnot_add_drop.py (coarser time step), , SF leakage
sfg-blockadepaper_b_blockade.pysuccess at ; at the special times
hom-constraintmis_anneal.py, gadget at full conversion
mis-annealmis_anneal.py, anneal3-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.