Repository: Qiskit/qiskit

Issue:
Result.get_data()['unitary'] differs from Result.get_unitary()
<!-- ⚠️ If you do not respect this template, your issue will be closed -->
<!-- ⚠️ Make sure to browse the opened and closed issues -->

### Informations

- **Qiskit Terra version**: Latest Master (assuming post https://github.com/Qiskit/qiskit-terra/pull/1360 )
- **Python version**: 3.7
- **Operating system**: Linux

### What is the current behavior?

When running a simulation with the unitary_simulator locally the result from Result.get_data()['unitary'] isn't the expected data format.

I have a script which running a GHZ test circuit through the unitary simulator I use for testing some visualizations and this started failing post #1360 when taking the dot product of an 8 entry array with the unitary from `result.get_data()['unitary']` because of a size mismatch so I started investigating.

It looks like the to_dict method at https://github.com/Qiskit/qiskit-terra/blob/master/qiskit/result/result.py#L84 doesn't know how to handle the complex numbers properly and is splitting them up into a list with each component .

### Steps to reproduce the problem
My test script is:
```
import qiskit
n = 3  # number of qubits
q = qiskit.QuantumRegister(n)
c = qiskit.ClassicalRegister(n, 'c')
ghz = qiskit.QuantumCircuit(q, c, name='ghz')
ghz.h(q[0])
ghz.cx(q[0], q[1])
ghz.cx(q[0], q[2])
ghz.s(q[0])
ghz.measure(q[0], c[0])
ghz.measure(q[1], c[1])
ghz.measure(q[2], c[2])
sim = 'unitary_simulator'
backend = qiskit.Aer.get_backend(sim)
result = qiskit.execute(ghz, backend, shots=1000).result()
unitary = result.get_unitary('ghz')
```
But it looks like anyone accessing the unitary from get_data()['unitary'] will hit this issue.

For one sample execution:
`result.get_data('ghz')['unitary']` returns
```
[[[0.7071067811865476, 0.0],
  [0.7071067811865475, -8.659560562354932e-17],
  [0.0, 0.0],
  [0.0, 0.0],
  [0.0, 0.0],
  [0.0, 0.0],
  [0.0, 0.0],
  [0.0, 0.0]],
 [[0.0, 0.0],
  [0.0, 0.0],
  [0.0, 0.0],
  [0.0, 0.0],
  [0.0, 0.0],
  [0.0, 0.0],
  [4.329780281177466e-17, 0.7071067811865475],
  [-1.29893408435324e-16, -0.7071067811865476]],
 [[0.0, 0.0],
  [0.0, 0.0],
  [0.7071067811865476, 0.0],
  [0.7071067811865475, -8.659560562354932e-17],
  [0.0, 0.0],
  [0.0, 0.0],
  [0.0, 0.0],
  [0.0, 0.0]],
 [[0.0, 0.0],
  [0.0, 0.0],
  [0.0, 0.0],
  [0.0, 0.0],
  [4.329780281177466e-17, 0.7071067811865475],
  [-1.29893408435324e-16, -0.7071067811865476],
  [0.0, 0.0],
  [0.0, 0.0]],
 [[0.0, 0.0],
  [0.0, 0.0],
  [0.0, 0.0],
  [0.0, 0.0],
  [0.7071067811865476, 0.0],
  [0.7071067811865475, -8.659560562354932e-17],
  [0.0, 0.0],
  [0.0, 0.0]],
 [[0.0, 0.0],
  [0.0, 0.0],
  [4.329780281177466e-17, 0.7071067811865475],
  [-1.29893408435324e-16, -0.7071067811865476],
  [0.0, 0.0],
  [0.0, 0.0],
  [0.0, 0.0],
  [0.0, 0.0]],
 [[0.0, 0.0],
  [0.0, 0.0],
  [0.0, 0.0],
  [0.0, 0.0],
  [0.0, 0.0],
  [0.0, 0.0],
  [0.7071067811865476, 0.0],
  [0.7071067811865475, -8.659560562354932e-17]],
 [[4.329780281177466e-17, 0.7071067811865475],
  [-1.29893408435324e-16, -0.7071067811865476],
  [0.0, 0.0],
  [0.0, 0.0],
  [0.0, 0.0],
  [0.0, 0.0],
  [0.0, 0.0],
  [0.0, 0.0]]]
```
and 
`unitary`
```
[[(0.7071067811865476+0j),
  (0.7071067811865475-8.659560562354932e-17j),
  0j,
  0j,
  0j,
  0j,
  0j,
  0j],
 [0j,
  0j,
  0j,
  0j,
  0j,
  0j,
  (4.329780281177466e-17+0.7071067811865475j),
  (-1.29893408435324e-16-0.7071067811865476j)],
 [0j,
  0j,
  (0.7071067811865476+0j),
  (0.7071067811865475-8.659560562354932e-17j),
  0j,
  0j,
  0j,
  0j],
 [0j,
  0j,
  0j,
  0j,
  (4.329780281177466e-17+0.7071067811865475j),
  (-1.29893408435324e-16-0.7071067811865476j),
  0j,
  0j],
 [0j,
  0j,
  0j,
  0j,
  (0.7071067811865476+0j),
  (0.7071067811865475-8.659560562354932e-17j),
  0j,
  0j],
 [0j,
  0j,
  (4.329780281177466e-17+0.7071067811865475j),
  (-1.29893408435324e-16-0.7071067811865476j),
  0j,
  0j,
  0j,
  0j],
 [0j,
  0j,
  0j,
  0j,
  0j,
  0j,
  (0.7071067811865476+0j),
  (0.7071067811865475-8.659560562354932e-17j)],
 [(4.329780281177466e-17+0.7071067811865475j),
  (-1.29893408435324e-16-0.7071067811865476j),
  0j,
  0j,
  0j,
  0j,
  0j,
  0j]]
```

### What is the expected behavior?
I would expect result['unitary'] and unitary to have the same data. 

### Suggested solutions

Investigate the cause of what's transforming the complex numbers into a list and then adjust it to not do that.


Discussion:

Resolving patch:
diff --git a/qiskit/result/result.py b/qiskit/result/result.py
--- a/qiskit/result/result.py
+++ b/qiskit/result/result.py
@@ -47,7 +47,7 @@ def data(self, circuit=None):
         """Get the raw data for an experiment.
 
         Note this data will be a single classical and quantum register and in a
-        format required by the results schema. We recomened that most  users use
+        format required by the results schema. We recomened that most users use
         the get_xxx method and the data will be post processed for the data type.
 
         Args:
@@ -59,23 +59,32 @@ def data(self, circuit=None):
                 * None: if there is only one experiment, returns it.
 
         Returns:
-            dict: A dictionary of results data for an experiment. The data depends on
-            the backend it ran on.
-
-            QASM backend backend returns a dictionary of dictionary with
-            key 'counts' and  with the counts, with the second dictionary keys
-            containing a string in hex format (``0x123``) and values equal to the
-            number of times this outcome was measured.
-
-            Statevector backend returns a dictionary with key 'statevector' and values being a
-            list[complex] list of 2^n_qubits complex amplitudes.
-
-            Unitary backend returns a dictionary with key 'unitary' and values being a
-            list[list[complex]] list of 2^n_qubits x 2^n_qubits complex
-            amplitudes.
-
-            The simulator backends also have an optional 'key' snapshot which returns
-            a dict of snapshots specified by the simulator backend.
+            dict: A dictionary of results data for an experiment. The data
+            depends on the backend it ran on.
+
+            QASM backends return a dictionary of dictionary with the key
+            'counts' and  with the counts, with the second dictionary keys
+            containing a string in hex format (``0x123``) and values equal to
+            the number of times this outcome was measured.
+
+            Statevector backends return a dictionary with key 'statevector' and
+            values being a list[list[complex components]] list of 2^n_qubits
+            complex amplitudes. Where each complex number is represented as a 2
+            entry list for each component. For example, a list of
+            [0.5+1j, 0-1j] would be represented as [[0.5, 1], [0, -1]].
+
+            Unitary backends return a dictionary with key 'unitary' and values
+            being a list[list[list[complex components]]] list of
+            2^n_qubits x 2^n_qubits complex amplitudes in a two entry list for
+            each component. For example if the amplitude is
+            [[0.5+0j, 0-1j], ...] the value returned will be
+            [[[0.5, 0], [0, -1]], ...].
+
+            The simulator backends also have an optional key 'snapshot' which
+            returns a dict of snapshots specified by the simulator backend.
+            The value is of the form dict[slot: dict[str: array]]
+            where the keys are the requested snapshot slots, and the values are
+            a dictionary of the snapshots.
 
         Raises:
             QISKitError: if data for the experiment could not be retrieved.
@@ -151,7 +160,7 @@ def get_snapshots(self, circuit=None):
         Returns:
             dict[slot: dict[str: array]]: dictionary where the keys are the
                 requested snapshot slots, and the values are a dictionary of
-                the snapshots themselves.
+                the snapshots.
 
         Raises:
             QISKitError: if there are no snapshots for the experiment.


Test patch: