Skip to content

Application demos

Quon is a circuit language, not an optimization framework. The application demos under samples/applications/ (issue #191) make that boundary explicit: each one is a .qn circuit — the quantum half of a hybrid algorithm — paired with a classical outer loop in Python. The .qn lowers and typechecks; the Python does the parts Quon has no business doing (parameter optimization, cost evaluation, route decoding).

This page summarizes the demos. Each is also documented in samples/applications/README.md and verified by a seeded checker under test/verify/.

Across every demo the split is the same:

  • Quon (the .qn circuit). Prepares a parameterized quantum state — a QAOA cost+mixer ansatz, a Trotterized Ising evolution, or a VQE hardware ansatz — and proves a compile-time depth bound via the Circuit<Q, N, D, F> type. The variational angles are baked in as literals.
  • Classical Python (the checker / outer loop). Picks the angles (a statevector sweep / classical optimizer), evaluates the objective from measurement data, and does any problem-specific decoding (e.g. decoding a TSP bitstring to a city tour, then 2-opt). Quon has none of this.

MaxCut on the 6-vertex triangular prism (3-regular, MaxCut = 7) via one QAOA layer (Rzz(gamma) cost edges + Rx(beta) mixer on a Hadamard state). maxcut_prism6.qn proves depth 11; the checker maxcut_prism6.py runs it on Aer and asserts the expected cut ≥ 0.8 × MaxCut and that the most-probable bitstring is an optimal cut.

The same C5 graph at p=1 and p=2 to show the depth/quality tradeoff directly. maxcut_c5_p1.qn (depth 7) reaches expected cut ~3.75; the p=2 companion maxcut_c5_p2.qn (depth 13) closes the gap to the optimum (~4.0). The checker maxcut_depth.py compiles both and asserts p=2 ≥ p=1.

The transverse-field Ising model on a ring (periodic boundary), extending the open-chain ising.qn fixture with the closing bond. Trotter parameters (J, h, t, n_steps) are Quon Float/Int params, partial-evaluated into rotation angles. ising_ring.qn

  • ising_ring.py, which checks the t = 0 identity (all-zeros) oracle.

A hardware-efficient Ry/CNOT ansatz for a 2-qubit model Hamiltonian (ground energy −1.400). The whole VQE outer loop — energy evaluation, the optimizer, Pauli grouping — is classical; Quon only lowers the ansatz. vqe_ansatz.qn

  • vqe_ansatz.py, which extracts the statevector from the compiled circuit, computes ⟨H⟩ exactly, and checks it equals the ground energy (plus a seeded Aer consistency check). A SKETCH of VQE structure, not a chemistry-accuracy claim.

A schematic: a small TSP-shaped cost Hamiltonian (weighted Rzz couplings + Rz penalty fields) on 4 qubits in one QAOA layer — the same circuit shape a TSP-to-Ising reformulation emits. Tour decoding, constraint enforcement, and 2-opt are classical and live outside Quon. tsp_sketch.qn

  • tsp_sketch.py (structural: compiles + shaped, parseable QASM — not a TSP solver).

Build the compiler, then run any checker — the Aer bridge auto-discovers target/release/quonc (#375), so no QUONC export is needed:

Terminal window
cargo build --release -p quonc
python test/verify/maxcut_prism6.py

Every ci: smoke catalog entry is also compiled with quonc in CI (the samples_catalog test); the Aer checkers above are seeded for reproducibility.