cirq.experiments.build_entangling_layers

cirq.experiments.build_entangling_layers(qubits: Sequence[cirq.devices.grid_qubit.GridQubit], two_qubit_gate: cirq.ops.gate_features.TwoQubitGate) → List[cirq.ops.moment.Moment][source]

Builds a sequence of gates that entangle all pairs of qubits on a grid.

The qubits are restricted to be physically on a square grid with distinct
row and column indices (not every node of the grid needs to have a
qubit). To entangle all pairs of qubits, a user-specified two-qubit gate
is applied between each and every pair of qubit that are next to each
other. In general, a total of four sets of parallel operations are needed to
perform all possible two-qubit gates. We proceed as follows:
The first layer applies two-qubit gates to qubits (i, j) and (i, j + 1)
where i is any integer and j is an even integer. The second layer
applies two-qubit gates to qubits (i, j) and (i + 1, j) where i is an even
integer and j is any integer. The third layer applies two-qubit gates
to qubits (i, j) and (i, j + 1) where i is any integer and j is an odd
integer. The fourth layer applies two-qubit gates to qubits (i, j) and
(i + 1, j) where i is an odd integer and j is any integer.

After the layers are built as above, any empty layer is ejected.:

         Cycle 1:                            Cycle 2:
q00 ── q01    q02 ── q03            q00    q01    q02    q03
                                     |      |      |      |
q10 ── q11    q12 ── q13            q10    q11    q12    q13

q20 ── q21    q22 ── q23            q20    q21    q22    q23
                                     |      |      |      |
q30 ── q31    q32 ── q33            q30    q31    q32    q33

          Cycle 3:                           Cycle 4:
q00    q01 ── q02    q03            q00    q01    q02    q03

q10    q11 ── q12    q13            q10    q11    q12    q13
                                     |      |      |      |
q20    q21 ── q22    q23            q20    q21    q22    q23

q30    q31 ── q32    q33            q30    q31    q32    q33
Parameters
  • qubits – The grid qubits included in the entangling operations.

  • two_qubit_gate – The two-qubit gate to be applied between all neighboring pairs of qubits.

Returns

A list of ops.Moment, with a maximum length of 4. Each ops.Moment includes two-qubit gates which can be performed at the same time.