Quantum Circuit
A sequence of quantum gates applied to qubits, representing a quantum computation.
A quantum circuit is the standard model for describing quantum computations. It shows qubits as horizontal lines (wires) and gates as boxes or symbols applied to those wires.
Structure
┌───┐ ┌───┐
q0: ─┤ H ├──●──┤ X ├─ M
└───┘ │ └───┘
│
q1: ────────⊕──────── M
Components:
- Wires: Horizontal lines representing qubits (time flows left to right)
- Gates: Boxes/symbols representing quantum operations
- Measurements: Usually at the end, marked with M or meter symbol
Reading a Circuit
- Start with initial states (usually for each qubit)
- Apply gates from left to right
- Gates on different wires at the same horizontal position happen simultaneously
- Measure at the end to get classical output
Circuit Metrics
Width
Number of qubits used.
Depth
See Circuit Depth for more details on time steps (layers of parallel gates).
Gate Count
Total number of gates, often broken down by type (single-qubit, two-qubit, T-gates).
Example: Bell State Preparation
┌───┐
q0: ─┤ H ├──●──
└───┘ │
│
q1: ────────⊕──
- Start:
- H on q0:
- CNOT:
Circuit Identities
Gates can often be simplified:
- (Hadamard is self-inverse)
- , ,
- Adjacent CNOTs cancel
- ,
Optimizers use these to reduce circuit complexity.
Subcircuits and Oracles
Complex operations are often drawn as single boxes:
┌─────────┐
q: ──┤ ├──
│ U │
q: ──┤ ├──
│ │
q: ──┤ ├──
└─────────┘
This abstracts away internal details.
Barriers
Vertical lines that prevent optimization across them:
q0: ──H──|──X──
|
q1: ──X──|──H──
Useful for separating distinct algorithm phases.
Classical Control
Modern circuits support mid-circuit measurement and classical feedback:
q0: ──H──M─────
║
╠══╗
q1: ─────║──X── (X if measurement = 1)
Double lines represent classical bits; gates conditioned on classical values.
See also: Quantum Gate, Circuit Depth, Quantum Algorithm, SWAP Gate