prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  rzz gate
  <!-- ⚠️ If you do not respect this template, your issue will be closed -->
  <!-- ⚠️ Make sure to browse the opened and closed issues -->
  
  ### Information
  
  - **Qiskit Terra version**: 0.7.2
  - **Python version**: 3.6.6
  - **Operating system**: Windows 10
  
  ### What is the current behavior?
  
  rzz gate appears to give incorrect results
  
  ### Steps to reproduce the problem
  
  rzz gate rule defined in https://github.com/Qiskit/qiskit-terra/blob/master/qiskit/extensions/standard/rzz.py
  
  ```
              CnotGate(q[0], q[1]),
              U1Gate(self.params[0], q[0]),
              CnotGate(q[0], q[1])
  ```
  
  ### What is the expected behavior?
  
  I think it should be
  ```
              CnotGate(q[0], q[1]),
              U1Gate(self.params[0], q[1]),
              CnotGate(q[0], q[1])
  ```
  the u1 phase should be on the target instead of control
  
  ### Suggested solutions
  
  modify rzz gate definition to give the right behavior.
  
  
  </issue>
  <code>
  [start of qiskit/extensions/standard/rzz.py]
  1 # -*- coding: utf-8 -*-
  2 
  3 # Copyright 2017, IBM.
  4 #
  5 # This source code is licensed under the Apache License, Version 2.0 found in
  6 # the LICENSE.txt file in the root directory of this source tree.
  7 
  8 """
  9 two-qubit ZZ-rotation gate.
  10 """
  11 from qiskit.circuit import CompositeGate
  12 from qiskit.circuit import Gate
  13 from qiskit.circuit import QuantumCircuit
  14 from qiskit.circuit import QuantumRegister
  15 from qiskit.circuit.decorators import _op_expand
  16 from qiskit.dagcircuit import DAGCircuit
  17 from qiskit.extensions.standard.u1 import U1Gate
  18 from qiskit.extensions.standard.cx import CnotGate
  19 
  20 
  21 class RZZGate(Gate):
  22     """Two-qubit ZZ-rotation gate."""
  23 
  24     def __init__(self, theta, ctl, tgt, circ=None):
  25         """Create new rzz gate."""
  26         super().__init__("rzz", [theta], [ctl, tgt], circ)
  27 
  28     def _define_decompositions(self):
  29         """
  30         gate rzz(theta) a, b { cx a, b; u1(theta) b; cx a, b; }
  31         """
  32         decomposition = DAGCircuit()
  33         q = QuantumRegister(2, "q")
  34         decomposition.add_qreg(q)
  35         rule = [
  36             CnotGate(q[0], q[1]),
  37             U1Gate(self.params[0], q[0]),
  38             CnotGate(q[0], q[1])
  39         ]
  40         for inst in rule:
  41             decomposition.apply_operation_back(inst)
  42         self._decompositions = [decomposition]
  43 
  44     def inverse(self):
  45         """Invert this gate."""
  46         self.params[0] = -self.params[0]
  47         self._decompositions = None
  48         return self
  49 
  50     def reapply(self, circ):
  51         """Reapply this gate to corresponding qubits in circ."""
  52         self._modifiers(circ.rzz(self.params[0], self.qargs[0], self.qargs[1]))
  53 
  54 
  55 @_op_expand(2, broadcastable=[False, False])
  56 def rzz(self, theta, qubit1, qubit2):
  57     """Apply RZZ to circuit."""
  58     self._check_qubit(qubit1)
  59     self._check_qubit(qubit2)
  60     self._check_dups([qubit1, qubit2])
  61     return self._attach(RZZGate(theta, qubit1, qubit2, self))
  62 
  63 
  64 # Add to QuantumCircuit and CompositeGate classes
  65 QuantumCircuit.rzz = rzz
  66 CompositeGate.rzz = rzz
  67
  [end of qiskit/extensions/standard/rzz.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/qiskit/extensions/standard/rzz.py b/qiskit/extensions/standard/rzz.py
  --- a/qiskit/extensions/standard/rzz.py
  +++ b/qiskit/extensions/standard/rzz.py
  @@ -34,7 +34,7 @@
           decomposition.add_qreg(q)
           rule = [
               CnotGate(q[0], q[1]),
  -            U1Gate(self.params[0], q[0]),
  +            U1Gate(self.params[0], q[1]),
               CnotGate(q[0], q[1])
           ]
           for inst in rule:
  
verification_info: {"golden_diff": "diff --git a/qiskit/extensions/standard/rzz.py b/qiskit/extensions/standard/rzz.py\n--- a/qiskit/extensions/standard/rzz.py\n+++ b/qiskit/extensions/standard/rzz.py\n@@ -34,7 +34,7 @@\n         decomposition.add_qreg(q)\n         rule = [\n             CnotGate(q[0], q[1]),\n-            U1Gate(self.params[0], q[0]),\n+            U1Gate(self.params[0], q[1]),\n             CnotGate(q[0], q[1])\n         ]\n         for inst in rule:\n", "issue": "rzz gate\n<!-- \u26a0\ufe0f If you do not respect this template, your issue will be closed -->\r\n<!-- \u26a0\ufe0f Make sure to browse the opened and closed issues -->\r\n\r\n### Information\r\n\r\n- **Qiskit Terra version**: 0.7.2\r\n- **Python version**: 3.6.6\r\n- **Operating system**: Windows 10\r\n\r\n### What is the current behavior?\r\n\r\nrzz gate appears to give incorrect results\r\n\r\n### Steps to reproduce the problem\r\n\r\nrzz gate rule defined in https://github.com/Qiskit/qiskit-terra/blob/master/qiskit/extensions/standard/rzz.py\r\n\r\n```\r\n            CnotGate(q[0], q[1]),\r\n            U1Gate(self.params[0], q[0]),\r\n            CnotGate(q[0], q[1])\r\n```\r\n\r\n### What is the expected behavior?\r\n\r\nI think it should be\r\n```\r\n            CnotGate(q[0], q[1]),\r\n            U1Gate(self.params[0], q[1]),\r\n            CnotGate(q[0], q[1])\r\n```\r\nthe u1 phase should be on the target instead of control\r\n\r\n### Suggested solutions\r\n\r\nmodify rzz gate definition to give the right behavior.\r\n\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n\n# Copyright 2017, IBM.\n#\n# This source code is licensed under the Apache License, Version 2.0 found in\n# the LICENSE.txt file in the root directory of this source tree.\n\n\"\"\"\ntwo-qubit ZZ-rotation gate.\n\"\"\"\nfrom qiskit.circuit import CompositeGate\nfrom qiskit.circuit import Gate\nfrom qiskit.circuit import QuantumCircuit\nfrom qiskit.circuit import QuantumRegister\nfrom qiskit.circuit.decorators import _op_expand\nfrom qiskit.dagcircuit import DAGCircuit\nfrom qiskit.extensions.standard.u1 import U1Gate\nfrom qiskit.extensions.standard.cx import CnotGate\n\n\nclass RZZGate(Gate):\n    \"\"\"Two-qubit ZZ-rotation gate.\"\"\"\n\n    def __init__(self, theta, ctl, tgt, circ=None):\n        \"\"\"Create new rzz gate.\"\"\"\n        super().__init__(\"rzz\", [theta], [ctl, tgt], circ)\n\n    def _define_decompositions(self):\n        \"\"\"\n        gate rzz(theta) a, b { cx a, b; u1(theta) b; cx a, b; }\n        \"\"\"\n        decomposition = DAGCircuit()\n        q = QuantumRegister(2, \"q\")\n        decomposition.add_qreg(q)\n        rule = [\n            CnotGate(q[0], q[1]),\n            U1Gate(self.params[0], q[0]),\n            CnotGate(q[0], q[1])\n        ]\n        for inst in rule:\n            decomposition.apply_operation_back(inst)\n        self._decompositions = [decomposition]\n\n    def inverse(self):\n        \"\"\"Invert this gate.\"\"\"\n        self.params[0] = -self.params[0]\n        self._decompositions = None\n        return self\n\n    def reapply(self, circ):\n        \"\"\"Reapply this gate to corresponding qubits in circ.\"\"\"\n        self._modifiers(circ.rzz(self.params[0], self.qargs[0], self.qargs[1]))\n\n\n@_op_expand(2, broadcastable=[False, False])\ndef rzz(self, theta, qubit1, qubit2):\n    \"\"\"Apply RZZ to circuit.\"\"\"\n    self._check_qubit(qubit1)\n    self._check_qubit(qubit2)\n    self._check_dups([qubit1, qubit2])\n    return self._attach(RZZGate(theta, qubit1, qubit2, self))\n\n\n# Add to QuantumCircuit and CompositeGate classes\nQuantumCircuit.rzz = rzz\nCompositeGate.rzz = rzz\n", "path": "qiskit/extensions/standard/rzz.py"}]}