Repository: Qiskit/qiskit

Issue:
text drawer: long params should not print
<!-- ⚠️ If you do not respect this template, your issue will be closed -->
<!-- ⚠️ Make sure to browse the opened and closed issues to confirm this idea does not exist. -->

### What is the expected enhancement?
Some gates have very long params, for example a Unitary gate with a big matrix as its param. In this case we should just print the gate name (e.g. "unitary"). I think we should have an upper bound on the length of param that gets printed.

```python
from qiskit import QuantumRegister, QuantumCircuit
from qiskit.quantum_info.random import random_unitary
qr = QuantumRegister(2)
qc = QuantumCircuit(qr)
U1 = random_unitary(4)
qc.append(U2, [qr[0], qr[1]])
qc.draw(output='text', line_length=1000)
```

```
          ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
q41_0: |0>┤0                                                                                                                                                                                                                                                                                                                                                                                                                              ├
          │  unitary([[-0.3794878 -0.78729597j  0.27032976-0.01244361j -0.14796288-0.12451722j
  -0.33736711-0.10819849j]
 [-0.00417172+0.0353919j  -0.2500359 +0.25555567j  0.21747781+0.67564305j
  -0.55307508-0.24742917j]
 [ 0.08379332-0.27677401j -0.6132419 -0.64069463j  0.326534  -0.0859802j
  -0.06256294+0.10903404j]
 [-0.32374365-0.21552018j  0.08981208+0.06571817j  0.48386387+0.33267255j
   0.66896473-0.20987362j]]) │
q41_1: |0>┤1                                                                                                                                                                                                                                                                                                                                                                                                                              ├
          └───────────────────────────────────────────────────────────────────────────────────────────
```

should instead be:
![image](https://user-images.githubusercontent.com/8622381/56902341-169c5d00-6a68-11e9-8243-4a956c17cf46.png)





Discussion:

Resolving patch:
diff --git a/qiskit/visualization/text.py b/qiskit/visualization/text.py
--- a/qiskit/visualization/text.py
+++ b/qiskit/visualization/text.py
@@ -12,6 +12,7 @@
 from shutil import get_terminal_size
 import sys
 import sympy
+from numpy import ndarray
 
 from .exceptions import VisualizationError
 
@@ -617,9 +618,14 @@ def label_for_conditional(instruction):
 
     @staticmethod
     def params_for_label(instruction):
-        """Get the params and format them to add them to a label. None if there are no params."""
+        """Get the params and format them to add them to a label. None if there
+         are no params of if the params are numpy.ndarrays."""
+
         if not hasattr(instruction.op, 'params'):
             return None
+        if all([isinstance(param, ndarray) for param in instruction.op.params]):
+            return None
+
         ret = []
         for param in instruction.op.params:
             if isinstance(param, (sympy.Number, float)):


Test patch:
diff --git a/test/python/visualization/test_circuit_text_drawer.py b/test/python/visualization/test_circuit_text_drawer.py
--- a/test/python/visualization/test_circuit_text_drawer.py
+++ b/test/python/visualization/test_circuit_text_drawer.py
@@ -13,12 +13,15 @@
 from math import pi
 import unittest
 import sympy
+import numpy
 
 from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
 from qiskit.visualization import text as elements
 from qiskit.visualization.circuit_visualization import _text_circuit_drawer
 from qiskit.test import QiskitTestCase
 from qiskit.circuit import Gate, Parameter
+from qiskit.quantum_info.random import random_unitary
+from qiskit.quantum_info.operators import SuperOp
 
 
 class TestTextDrawerElement(QiskitTestCase):
@@ -961,6 +964,56 @@ def test_2Qgate_nottogether_across_4(self):
 
         self.assertEqual(str(_text_circuit_drawer(circuit, reverse_bits=True)), expected)
 
+    def test_unitary_nottogether_across_4(self):
+        """ Unitary that are 2 bits apart"""
+        expected = '\n'.join(["        ┌──────────┐",
+                              "q_0: |0>┤0         ├",
+                              "        │          │",
+                              "q_1: |0>┤          ├",
+                              "        │  unitary │",
+                              "q_2: |0>┤          ├",
+                              "        │          │",
+                              "q_3: |0>┤1         ├",
+                              "        └──────────┘"])
+
+        qr = QuantumRegister(4, 'q')
+        qc = QuantumCircuit(qr)
+
+        qc.append(random_unitary(4, seed=42), [qr[0], qr[3]])
+
+        self.assertEqual(str(_text_circuit_drawer(qc)), expected)
+
+    def test_kraus(self):
+        """ Test Kraus.
+        See https://github.com/Qiskit/qiskit-terra/pull/2238#issuecomment-487630014"""
+        expected = '\n'.join(["        ┌───────┐",
+                              "q_0: |0>┤ Kraus ├",
+                              "        └───────┘"])
+
+        error = SuperOp(0.75 * numpy.eye(4) + 0.25 * numpy.diag([1, -1, -1, 1]))
+        qr = QuantumRegister(1, name='q')
+        qc = QuantumCircuit(qr)
+        qc.append(error, [qr[0]])
+
+        self.assertEqual(str(_text_circuit_drawer(qc)), expected)
+
+    def test_multiplexer(self):
+        """ Test Multiplexer.
+        See https://github.com/Qiskit/qiskit-terra/pull/2238#issuecomment-487630014"""
+        expected = '\n'.join(["        ┌──────────────┐",
+                              "q_0: |0>┤0             ├",
+                              "        │  multiplexer │",
+                              "q_1: |0>┤1             ├",
+                              "        └──────────────┘"])
+
+        cx_multiplexer = Gate('multiplexer', 2, [numpy.eye(2), numpy.array([[0, 1], [1, 0]])])
+
+        qr = QuantumRegister(2, name='q')
+        qc = QuantumCircuit(qr)
+        qc.append(cx_multiplexer, [qr[0], qr[1]])
+
+        self.assertEqual(str(_text_circuit_drawer(qc)), expected)
+
 
 class TestTextDrawerParams(QiskitTestCase):
     """Test drawing parameters."""