build_entangling_layers(qubits: Sequence[cirq.devices.grid_qubit.GridQubit], two_qubit_gate: cirq.ops.gate_features.TwoQubitGate) → List[cirq.ops.moment.Moment]¶
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 distinctrow and column indices (not every node of the grid needs to have aqubit). To entangle all pairs of qubits, a user-specified two-qubit gateis applied between each and every pair of qubit that are next to eachother. In general, a total of four sets of parallel operations are needed toperform 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 layerapplies two-qubit gates to qubits (i, j) and (i + 1, j) where i is an eveninteger and j is any integer. The third layer applies two-qubit gatesto qubits (i, j) and (i, j + 1) where i is any integer and j is an oddinteger. 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
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.
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.