# Quantum Circuits

A quantum circuit diagram is a visualization of a quantum algorithm, specifically the steps that execute on or near a quantum processor. It does not depict classical processing unless it occurs during circuit execution. A quantum circuit simulator may be used to verify small algorithms before they execute on real hardware, or before they scale to sizes beyond classical simulation.

Quantum circuits are associated with the digital mode of quantum computing, and there are analog quantum computers for which this information does not apply. Photonic quantum computers use circuits that loosely resemble what will be described here, but operate quite differently. On the other hand, some diagrams don’t resemble what will be described here at all, but they are applied the same. And, finally, some diagrams initially look quite different, but the differences are purely aesthetic.

To start learning about quantum circuits, check out the Quantum Country website by Andy Matuschak and Michael Nielsen. For more detailed information, check out the list of books on the ScienceDirect “Quantum Circuit” page.

## What is a Quantum Circuit

A quantum circuit is a high-level abstraction for how an algorithm executes on real hardware. Developers may be shielded from the two steps between building a circuit and running it. The first of those steps is transpilation, during which the higher-level gates on the diagram are decomposed into the lower-level gates that can execute. Then the second of those steps is the compilation of those lower-level gates into the pulse schedule that will execute.

Some providers offer what can be called analog quantum circuits. They resemble quantum circuits after transpilation, but the familiar gates are replaced with representations of the pulses that they have been compiled into. Each pulse resembles the types of pulses you would find with analog quantum computing.

## Anatomy of a Quantum Circuit

Variations exist, but the elements of a quantum circuit diagram are mostly standardized:

- Qubits are represented as horizontal lines, numbered top to bottom starting at 0
- Bits are represented as double horizontal lines and may be bundled together
- Qubits and classical bits may be organized into quantum registers or classical registers
- Operations execute from left to right; all vertical operations execute simultaneously
- The first operation is initializing the qubits, typically to |0⟩
- Most of the circuit consists of single-qubit and multi-qubit gates
- The circuit may feature mid-circuit measurements and classical conditional logic
- The final operations are the final measurements

The results of the final measurements are returned as classical bits, which often undergo some kind of classical processing. That might be the final post-processing, or it might be mid-processing that leads to the execution of another quantum circuit.

One noticeable property of quantum circuits is that they make no distinction between physical qubits and logical qubits. Furthermore, there may be inaccessible qubits on the processor that are performing important quantum error suppression and quantum error correction (QEC) functions. The diagrams are limited to showing only what’s relevant to algorithm execution.

## Quantum CircuitApplications and Challenges

Quantum circuits have several applications and face several challenges. The three applications are:

- Teaching quantum circuits
- Building circuits for classical simulation
- Optimizing circuits for execution on real hardware

And the biggest challenges are:

- They can’t visualize large circuits, such as those needed for quantum phase estimation.
- They don’t incorporate the classical processing of hybrid quantum computing.
- Abstraction conceals how deep the quantum circuits actually are.
- They don’t warn when circuit depth reaches the coherence limits of the qubits.
- They don’t indicate the quality of the physical qubits being selected.

The first point can be mitigated somewhat by diagrams that allow the collapse and expansion of high-level gates. A fully-collapsed circuit is easier to visualize, although still only up to a certain point. Also, the last point is not relevant to all qubit modalities. It is relevant when using fabricated qubits, but neutral atoms are perfectly identical and don’t deviate qualitatively.