import cirq from cirq.devices import GridQubit from cirq.ops import X, Y, Z, H, Rx, Ry, Rz from cirq.ops import CNOT, CZ, SWAP ckt = cirq.Circuit() rads1 = cirq.Symbol("rads1") ckt.append(H(GridQubit(1, 5))) ckt.append(X(GridQubit(1, 4))) ckt.append(Y(GridQubit(1, 4))) ckt.append(Z(GridQubit(1, 4))) ckt.append(Rx(rads=rads1*.5*(-2)).on(GridQubit(1, 5))) ckt.append(Ry(rads=-rads1*(-2)).on(GridQubit(1, 5))) ckt.append(Rz(rads=-2.0943951023931953).on(GridQubit(1, 5))) ckt.append(Rz(rads=-0.7675840859664933).on(GridQubit(1, 6))) ckt.append(Ry(rads=-1.4439793494898376).on(GridQubit(1, 6))) ckt.append(Rz(rads=-1.943589293061628).on(GridQubit(1, 6))) # 1->0 allowed by c_to_tars ckt.append(CNOT(GridQubit(0, 6), GridQubit(0, 5))) # 0->1 allowed by c_to_tars ckt.append(CNOT(GridQubit(0, 5), GridQubit(0, 6))) # 1->2 not allowed by c_to_tars # SIGX AT 2 IF 1T # not allowed in strict mode ckt.append(Z**rads1/np.pi.on(GridQubit(1, 4))) ckt.append(CZ**-rads1/np.pi.on(GridQubit(0, 5), GridQubit(1, 4))) ckt.append(SWAP(GridQubit(1, 4), GridQubit(0, 5)))