Writing Circuits in OpenQASM

The circuit language Jobs accepts, and its rules.

Jobs runs circuits written in OpenQASM 2.0 or 3.0. A program declares registers, applies gates and measures:

OPENQASM 2.0;
include "qelib1.inc";
qreg q[3];
creg c[3];
h q[0];
cx q[0], q[1];
cx q[1], q[2];
measure q -> c;
  • Only the standard libraries can be included: qelib1.inc (OpenQASM 2) and stdgates.inc (OpenQASM 3).
  • If a circuit has no measure, all qubits are measured at the end.
  • Common gates: x y z h s t rx ry rz cx cz swap ccx.

Circuits that break these rules are explained and not run.