open-standards/wai/quantum-conformance/formats/qasm/every_gate.qasm
Transaction Science 5fe6f317c1 quantum-conformance: other formats, natively and under wasm32-wasip2
wai/quantum-conformance/formats/ holds a module for each construct, each
with the program it must read to (a reference held by the equivalence
ladder), the outcomes it gives, a round trip back to its format, the
formats it writes to, and every refusal with its code and its place: the
QIR specification's two example programs, every intrinsic, a QIR 1 module
with typed pointers, the profiles' refusals; jeff modules built field by
field from the schema; the jeff project's own structured benchmarks and
examples, unchanged; and OpenQASM sources written to each format, the QIR
written pinned by its BLAKE3. CI runs it in wai-quantum-formats.yml, with
the readers' and writers' unit tests.

The jeff reader now converts integers to floats and floats to integers,
and a QIR conversion is checked against the type it gives.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 07:16:32 -04:00

17 lines
831 B
Text

// Every gate of the language once, on qubits put in superpositions first,
// then every qubit measured: written to QIR and jeff, each read back the same
// circuit.
OPENQASM 3.0;
include "stdgates.inc";
qubit[3] q;
bit[3] c;
h q[0];
ry(0.37) q[1];
rx(1.1) q[2];
id q[0]; x q[0]; y q[1]; z q[2]; h q[0]; s q[1]; sdg q[2]; t q[0]; tdg q[1]; sx q[2]; sxdg q[0];
rx(0.3) q[0]; ry(-0.7) q[1]; rz(1.9) q[2]; p(0.45) q[0]; p(pi/4) q[1]; p(-pi/2) q[2]; U(0.2, 0.9, -1.4) q[1];
cx q[0], q[1]; cy q[1], q[2]; cz q[2], q[0]; ch q[0], q[2]; cp(0.8) q[1], q[0];
crx(0.6) q[0], q[1]; cry(-1.2) q[2], q[1]; crz(2.2) q[1], q[2]; cu(0.3, 0.4, 0.5, 0.6) q[0], q[2];
swap q[0], q[2]; iswap q[1], q[0]; rxx(0.7) q[0], q[1]; ryy(1.1) q[1], q[2]; rzz(-0.4) q[2], q[0];
ccx q[0], q[1], q[2]; ccz q[2], q[0], q[1]; cswap q[1], q[0], q[2];
c = measure q;