We're celebrating World Quantum Day 2022! Join us


Generate a random quantum circuit of a particular form.

Used in the notebooks

Used in the tutorials

This construction is based on the circuits used in the paper https://www.nature.com/articles/s41586-019-1666-5

The generated circuit consists of a number of "cycles", this number being specified by depth. Each cycle is actually composed of two sub-layers: a layer of single-qubit gates followed by a layer of two-qubit gates, controlled by their respective arguments, see below. The pairs of qubits in a given entangling layer is controlled by the pattern argument, see below.

qubits The qubits to use.
depth The number of cycles.
two_qubit_op_factory A callable that returns a two-qubit operation. These operations will be generated with calls of the form two_qubit_op_factory(q0, q1, prng), where prng is the pseudorandom number generator.
pattern A sequence of GridInteractionLayers, each of which determine which pairs of qubits are entangled. The layers in a pattern are iterated through sequentially, repeating until depth is reached.
single_qubit_gates Single-qubit gates are selected randomly from this sequence. No qubit is acted upon by the same single-qubit gate in consecutive cycles. If only one choice of single-qubit gate is given, then this constraint is not enforced.
add_final_single_qubit_layer Whether to include a final layer of single-qubit gates after the last cycle.
seed A seed or random state to use for the pseudorandom number generator.