|View source on GitHub|
Generate a random quantum circuit.
cirq.experiments.random_rotations_between_grid_interaction_layers_circuit( qubits: Iterable['cirq.GridQubit'], depth: int, *, two_qubit_op_factory: Callable[['cirq.GridQubit', 'cirq.GridQubit', 'np.random.RandomState'], 'cirq.OP_TREE'] = (lambda a, b, _: google.SYC(a, b)), pattern: Sequence[
cirq.experiments.GridInteractionLayer] = cirq.experiments.GRID_STAGGERED_PATTERN, single_qubit_gates: Sequence['cirq.Gate'] = (ops.X ** 0.5, ops.Y ** 0.5, ops.PhasedXPowGate(phase_exponent=0.25,\n exponent=0.5)), add_final_single_qubit_layer: bool = True, seed: "cirq.RANDOM_STATE_OR_SEED_LIKE" = None ) -> "cirq.Circuit"
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
depth. Each cycle is actually composed of two sub-layers:
a layer of single-qubit gates followed by a layer of two-qubit gates.
The single-qubit gates are chosen randomly from the gates specified by
single_qubit_gates, but with the constraint that no qubit is acted upon
by the same single-qubit gate in consecutive cycles. In the layer of
two-qubit gates, which pairs of qubits undergo interaction is determined
pattern, which is a sequence of two-qubit interaction sets. The
set of interactions in a two-qubit layer rotates through this sequence.
The two-qubit operations themselves are generated by the call
two_qubit_op_factory(a, b, prng), where
b are the qubits and
prng is the pseudorandom number generator.
At the end of the circuit, an additional layer of single-qubit gates is appended, subject to the same constraint regarding consecutive cycles described above.
If only one choice of single-qubit gate is given, then the constraint that excludes repeating single-qubit gates in consecutive cycles is not enforced.
||The qubits to use.|
||The number of cycles.|
A factory to generate two-qubit operations.
These operations will be generated with calls of the form
||The pattern of grid interaction layers to use.|
||The single-qubit gates to use.|
||Whether to include a final layer of single-qubit gates after the last cycle.|
||A seed or random state to use for the pseudorandom number generator.|