Ejemplo n.º 1
0
 def _decompose_(self, qubits: Sequence['cirq.Qid']) -> 'cirq.OP_TREE':
     x0, x1, x2, x3 = self._diag_angles_radians
     q0, q1 = qubits
     yield common_gates.ZPowGate(exponent=x2 / np.pi).on(q0)
     yield common_gates.ZPowGate(exponent=x1 / np.pi).on(q1)
     yield common_gates.CZPowGate(exponent=(x3 - (x1 + x2)) / np.pi).on(
         q0, q1)
     yield common_gates.XPowGate().on_each(q0, q1)
     yield common_gates.CZPowGate(exponent=x0 / np.pi).on(q0, q1)
     yield common_gates.XPowGate().on_each(q0, q1)
Ejemplo n.º 2
0
 def _decompose_(self, qubits):
     yield common_gates.ZPowGate(exponent=self.exponent)(qubits[0])
     yield common_gates.ZPowGate(exponent=self.exponent)(qubits[1])
     yield common_gates.CZPowGate(exponent=-2 * self.exponent,
                                  global_shift=-self.global_shift / 2)(
                                      qubits[0], qubits[1])