cirq.experiments.random_rotations_between_grid_interaction_layers_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] = <function <lambda>>, pattern: Sequence[cirq.experiments.random_quantum_circuit_generation.GridInteractionLayer] = (cirq.experiments.GridInteractionLayer(col_offset=0, vertical=True, stagger=True), cirq.experiments.GridInteractionLayer(col_offset=1, vertical=True, stagger=True), cirq.experiments.GridInteractionLayer(col_offset=1, vertical=False, stagger=True), cirq.experiments.GridInteractionLayer(col_offset=0, vertical=False, stagger=True), cirq.experiments.GridInteractionLayer(col_offset=1, vertical=False, stagger=True), cirq.experiments.GridInteractionLayer(col_offset=0, vertical=False, stagger=True), cirq.experiments.GridInteractionLayer(col_offset=0, vertical=True, stagger=True), cirq.experiments.GridInteractionLayer(col_offset=1, vertical=True, stagger=True)), single_qubit_gates: Sequence[cirq.Gate] = ((cirq.X**0.5), (cirq.Y**0.5), cirq.PhasedXPowGate(phase_exponent=0.25, exponent=0.5)), add_final_single_qubit_layer: bool = True, seed: cirq.RANDOM_STATE_OR_SEED_LIKE = None)cirq.Circuit[source]

Generate a random quantum circuit.

This construction is based on the circuits used in the paper
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.
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
by 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 a and 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.
Parameters
  • qubits – The qubits to use.

  • depth – The number of cycles.

  • two_qubit_op_factory – A factory to generate two-qubit operations. These operations will be generated with calls of the form two_qubit_op_factory(a, b, prng), where a and b are the qubits to operate on and prng is the pseudorandom number generator.

  • pattern – The pattern of grid interaction layers to use.

  • single_qubit_gates – The single-qubit gates to use.

  • 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.