B.2 Python API and reproduction commands
On this page · Permalink · Source line 81
The release code is intentionally compact. Its purpose is to verify the algebra and provide a reusable seed rather than to compete with optimized quantum simulators.
B.2.1 Core API
On this page · Permalink · Source line 86
Core packet API.
On this page · Permalink · Source line 87
from symmetry_packets import (
weight_basis,
residue_basis,
symmetric_subspace_dimension,
boson_fixed_number_dimension,
fermion_fixed_number_dimension,
PacketPlan,
rz,
xy_exchange,
hypercube_quotient,
circuit_leakage_bound,
hamiltonian_leakage_bound,
)B.2.2 Exact packet plan
On this page · Permalink · Source line 103
Fixed-weight packet compilation.
On this page · Permalink · Source line 104
plan = PacketPlan.fixed_weight(n=10, k=2)
packet_state = random_packet_state(plan, seed=12)
full_state = plan.embed(packet_state)
restricted_gate = plan.restrict_gate(
xy_exchange(theta=0.2),
qubits=(3, 4),
)
packet_state = restricted_gate @ packet_stateB.2.3 Validation
On this page · Permalink · Source line 116
From the project root, run
PYTHONPATH=code python3 code/validate.py
PYTHONPATH=code python3 code/validate_exact.py
PYTHONPATH=code python3 code/validate_boundaries.pyThe expected output reports successful formula checks and reconstruction errors near machine precision for the representative fixed-weight circuits.
B.2.4 Figure generation
On this page · Permalink · Source line 125
All figures in the PDF are generated by
python3 code/make_figures.pyThe generator writes vector PDF figures into the figures directory.
B.2.5 Build
On this page · Permalink · Source line 132
The complete rebuild command is
./run_all.shIt validates the Python code, regenerates figures, compiles the LaTeX source, and updates the checksums.