Repository: Qiskit/qiskit

Issue:
circuit.repeat duplicates global phase
<!-- ⚠️ 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**: master @ 4d3ed6a3
- **Python version**: 3.7.9
- **Operating system**: macOS catalina

### What is the current behavior?

Calling `circuit.repeat(1)` on a circuit with global phase seems to duplicate the global phase.

### Steps to reproduce the problem

If `u` is a circuit with only a Z gate and `u_with_phase` the same circuit but with a global phase of pi, then
```python
In [75]: u.draw()
Out[75]:
     ┌───┐
q_0: ┤ Z ├
     └───┘

In [79]: u_with_phase.draw()
Out[79]:
global phase: π
     ┌───┐
q_0: ┤ Z ├
     └───┘

In [80]: Operator(u) == Operator(u_with_phase)  # should be False since the matrices are not the same
Out[80]: False

In [81]: Operator(u) == Operator(u_with_phase.power(1))  # should still be False
Out[81]: True

```

### What is the expected behavior?



### Suggested solutions





Discussion:

Resolving patch:
diff --git a/qiskit/circuit/quantumcircuit.py b/qiskit/circuit/quantumcircuit.py
--- a/qiskit/circuit/quantumcircuit.py
+++ b/qiskit/circuit/quantumcircuit.py
@@ -437,8 +437,7 @@ def repeat(self, reps):
             QuantumCircuit: A circuit containing ``reps`` repetitions of this circuit.
         """
         repeated_circ = QuantumCircuit(*self.qregs, *self.cregs,
-                                       name=self.name + '**{}'.format(reps),
-                                       global_phase=reps * self.global_phase)
+                                       name=self.name + '**{}'.format(reps))
 
         # benefit of appending instructions: decomposing shows the subparts, i.e. the power
         # is actually `reps` times this circuit, and it is currently much faster than `compose`.


Test patch:
diff --git a/test/python/circuit/test_circuit_operations.py b/test/python/circuit/test_circuit_operations.py
--- a/test/python/circuit/test_circuit_operations.py
+++ b/test/python/circuit/test_circuit_operations.py
@@ -14,6 +14,7 @@
 """Test Qiskit's QuantumCircuit class."""
 
 from ddt import ddt, data
+import numpy as np
 from qiskit import BasicAer
 from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit
 from qiskit import execute
@@ -21,6 +22,7 @@
 from qiskit.circuit.exceptions import CircuitError
 from qiskit.test import QiskitTestCase
 from qiskit.circuit.library.standard_gates import SGate
+from qiskit.quantum_info import Operator
 
 
 @ddt
@@ -403,6 +405,14 @@ def test_repeat(self):
             rep = qc.repeat(3)
             self.assertEqual(rep, ref)
 
+    @data(0, 1, 4)
+    def test_repeat_global_phase(self, num):
+        """Test the global phase is properly handled upon repeat."""
+        phase = 0.123
+        qc = QuantumCircuit(1, global_phase=phase)
+        expected = np.exp(1j * phase * num) * np.identity(2)
+        np.testing.assert_array_almost_equal(Operator(qc.repeat(num)).data, expected)
+
     def test_power(self):
         """Test taking the circuit to a power works."""
         qc = QuantumCircuit(2)