Aaron / goodcode
Publicdefault_spec() below:
| Zone | x | y | Allowed gates |
|---|---|---|---|
| storage | 0 – 9 | 0 – 9 | rx, rz |
| entangling | 0 – 9 | 10 – 19 | cz |
measure, barrier and move are allowed anywhere.
Geometry. Row and column indices are shared by all zones, so cols=(0, 1) covers columns 0 and 1 in
storage and in the entangling zone alike. Physical positions come from each zone's geometry:
spacing 1.0 apart."pairs": {"axis": "x", "distance": 0.3}.cz acts within a pair: both atoms must be on the same row, in columns 2k and 2k+1.rx, rz, cz). The supplied validator's
architecture also accepts rzz, so passing its checks alone does not enforce the written gate set.
The initial loading maps each qubit to its starting (x, y) site. Every site must be in storage; the
validator checks this.rows (y) and cols (x), and every atom on a rows × cols
intersection moves to the matching new_rows × new_cols intersection. You also list the qubits being
moved. A move leaves the quantum state unchanged, so its definition is the identity. ┌─────────┐┌─────────────────────────────────┐ »
q_0: ┤ Rx(0.5) ├┤0 ├─■─»
└─────────┘│ Move((0,),(0, 1),(10,),(0, 1)) │ │ »
q_1: ───────────┤1 ├─■─»
└─────────────────────────────────┘ »
« ┌─────────────────────────────────┐
«q_0: ┤0 ├
« │ Move((10,),(0, 1),(0,),(0, 1)) │
«q_1: ┤1 ├
« └─────────────────────────────────┘rows, cols): must be contiguous and ascending, e.g. cols=(0, 1, 2, 3).new_rows, new_cols): the exact final coordinates of the moved atoms, ascending.(0, 1, 2, 3) -> (0, 2, 4, 6). Moves that
break this are still allowed; the validator logs a warning, counts it and doubles that move's time.0, 1, 4 of range(5) (gaps 1, 3):(0, 2, 8) works (gaps ×2);(0, 1, 2) and (0, 2, 4) are allowed but logged, because the gaps don't scale evenly. ┌─────────────────────────────────────────────┐»
q_0: ┤0 ├»
│ │»
q_1: ┤1 ├»
│ Move((0,),(0, 1, 2, 3),(10,),(0, 2, 4, 6)) │»
q_2: ┤2 ├»
│ │»
q_3: ┤3 ├»
└─────────────────────────────────────────────┘»
« ┌──────────────────────────────────────────────────────┐
«q_0: ┤0 ├
« │ │
«q_1: ┤1 ├
« │ Move((10,),(0, 1, 2, 3, 4, 5, 6),(0,),(0, 1, 2, 3)) │
«q_2: ┤2 ├
« │ │
«q_3: ┤3 ├
« └──────────────────────────────────────────────────────┘cols=(0, 2);(0, 1) -> (2, 0);Move already rejects them when you build the circuit. The
others depend on where the atoms are, so only the validator catches them.compile_circuit(circuit, architecture_spec) below. It returns the compiled
circuit and an Architecture(initial_loading, spec=architecture_spec) holding your initial loading.00 keeps all three stops. The low bit is the first
qubit of the triangle's register. Integers 1, 2, and 3 drop the corresponding stop.
A layer of eight adjustable RX rotations generates candidate covers and stays in storage.
The original objective is the maintenance cost plus 5 for each uncovered neighborhood.
Links between triangles are evaluated when scoring samples. The example trains the angles
with ideal simulation and reports the most likely measured cover.planqc/pushquantum-2026-metric-hea
dataset (OpenQASM 2.0) goes through compile_circuit on the default architecture. The table below
updates whenever you change compile_circuit.move instruction for AOD row/column moves;Architecture that loads its zones from a spec, together with the initial positions of the qubits;compile_circuit(circuit, architecture_spec) -> (circuit, architecture).pushquantum-validator). It checks that
every move and gate follows the rules below, and that the circuit is equivalent to the input.
Open this notebook with marimo edit --sandbox notebook.py: the dependencies are declared inline. ┌───┐ ░ ┌─┐
q_0: ┤ H ├──■────────░─┤M├──────
└───┘┌─┴─┐ ░ └╥┘┌─┐
q_1: ─────┤ X ├──■───░──╫─┤M├───
└───┘┌─┴─┐ ░ ║ └╥┘┌─┐
q_2: ──────────┤ X ├─░──╫──╫─┤M├
└───┘ ░ ║ ║ └╥┘
meas: 3/═══════════════════╩══╩══╩═
0 1 2 Compiledglobal phase: 3π/2
┌──────────┐┌──────────┐┌──────────┐┌─────────────────────────────────┐»
q_0: ┤ Rz(-π/2) ├┤ Rx(-π/2) ├┤ Rz(-π/2) ├┤0 ├»
├─────────┬┘├─────────┬┘└──────────┘│ Move((9,),(0, 1),(10,),(0, 1)) │»
q_1: ┤ Rz(π/2) ├─┤ Rx(π/2) ├─────────────┤1 ├»
├─────────┤ ├─────────┤ └─────────────────────────────────┘»
q_2: ┤ Rz(π/2) ├─┤ Rx(π/2) ├────────────────────────────────────────────────»
└─────────┘ └─────────┘ »
meas: 3/═══════════════════════════════════════════════════════════════════════»
»
« »
« q_0: ─■───────────────────────────────────────────────────────»
« │ ┌────────────────────────────┐┌──────────┐┌──────────┐»
« q_1: ─■─┤ Move((10,),(1,),(9,),(1,)) ├┤ Rx(-π/2) ├┤ Rz(-π/2) ├»
« └────────────────────────────┘└──────────┘└──────────┘»
« q_2: ─────────────────────────────────────────────────────────»
« »
«meas: 3/═════════════════════════════════════════════════════════»
« »
« »
« q_0: ────────────────────────────────────────────────────────────────────»
« ┌─────────────────────────────────┐ »
« q_1: ┤0 ├─■───────────────────────────────»
« │ Move((9,),(1, 2),(10,),(2, 3)) │ │ ┌────────────────────────────┐»
« q_2: ┤1 ├─■─┤ Move((10,),(3,),(9,),(2,)) ├»
« └─────────────────────────────────┘ └────────────────────────────┘»
«meas: 3/════════════════════════════════════════════════════════════════════»
« »
« ░ ┌─┐
« q_0: ─────────────────────────░─┤M├──────
« ░ └╥┘┌─┐
« q_1: ─────────────────────────░──╫─┤M├───
« ┌──────────┐┌──────────┐ ░ ║ └╥┘┌─┐
« q_2: ┤ Rx(-π/2) ├┤ Rz(-π/2) ├─░──╫──╫─┤M├
« └──────────┘└──────────┘ ░ ║ ║ └╥┘
«meas: 3/════════════════════════════╩══╩══╩═
« 0 1 2 Initial loading (qubit → (x, y))