Fix a finite or infinite set of unitaries, each acting on a fixed number of qubits (in practice one or two): the gate set. A quantum circuit over on qubits is a finite sequence where each is a -qubit gate and is an ordered list of distinct qubits from on which it acts. The circuit implements the unitary
A run of the circuit prepares , applies and measures a designated set of qubits in the computational basis; by the Born rule the outcome string occurs with probability .
- The size of the circuit is , the number of gates.
- The width is , the number of qubits, ancillas included.
- The depth is the smallest such that the gates can be assigned to successive layers in each of which the sets are pairwise disjoint, with any two gates that share a qubit kept in their original order (equivalently, the length of the longest chain of gates linked by shared qubits). Gates in one layer commute and can be applied simultaneously.
- Restricted counts are defined the same way for a subset of , for instance the T-count (number of and gates) and the T-depth (number of layers that contain at least one of them, for a layering that minimises it).
A circuit family assigns a circuit to every input string (or to every input length). It is uniform if a deterministic classical Turing machine outputs a description of from in time polynomial in . Complexity classes such as BQP are defined with uniform families; without uniformity a family can encode the answers to an undecidable problem in its gate choices.
The network formulation goes back to Deutsch; Yao showed that uniform circuit families of polynomial size simulate quantum Turing machines with polynomial overhead. Section 4.6 of Nielsen and Chuang gives a textbook account.