Repository: Qiskit/qiskit

Issue:
Import Qiskit gives NumPy error due to misaligned array
<!-- ⚠️ 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 (NumPy 1.15.1)
- **Python version**:
- **Operating system**: Pi

### What is the current behavior?
Trying `import qiskit` on a fresh install gives the following error:

```python

~/berryconda3/lib/python3.6/site-packages/qiskit_terra-0.9.0-py3.6-linux-armv7l.egg/qiskit/quantum_info/synthesis/two_qubit_decompose.py in decompose_two_qubit_product_gate(special_unitary_matrix)
    105     # extract the left component
    106     temp = np.kron(np.eye(2), R.T.conj())
--> 107     special_unitary_matrix.dot(temp, temp)
    108     L = temp[::2, ::2]
    109     detL = L[0, 0]*L[1, 1] - L[0, 1]*L[1, 0]

ValueError: output array is not acceptable (must have the right datatype, number of dimensions, and be a C-Array)
```


### Steps to reproduce the problem



### What is the expected behavior?



### Suggested solutions
It appears that the `temp` matrix to be stored is not c-aligned.  This is not surprising given that the decomposition routines use eigensolvers that are fortran based and return f-aligned NumPy arrays.  The suggestion is to just do something like `temp = special_unitary_matrix.dot(temp)` instead.  The matrix is 4x4 so not so worried about a copy here.




Discussion:

Resolving patch:
diff --git a/qiskit/quantum_info/synthesis/two_qubit_decompose.py b/qiskit/quantum_info/synthesis/two_qubit_decompose.py
--- a/qiskit/quantum_info/synthesis/two_qubit_decompose.py
+++ b/qiskit/quantum_info/synthesis/two_qubit_decompose.py
@@ -104,7 +104,7 @@ def decompose_two_qubit_product_gate(special_unitary_matrix):
 
     # extract the left component
     temp = np.kron(np.eye(2), R.T.conj())
-    special_unitary_matrix.dot(temp, temp)
+    temp = special_unitary_matrix.dot(temp)
     L = temp[::2, ::2]
     detL = L[0, 0]*L[1, 1] - L[0, 1]*L[1, 0]
     if abs(detL) < 0.9:
@@ -198,35 +198,35 @@ def __init__(self, unitary_matrix):
         # Flip into Weyl chamber
         if cs[0] > pi2:
             cs[0] -= 3*pi2
-            K1l.dot(_ipy, out=K1l)
-            K1r.dot(_ipy, out=K1r)
+            K1l = K1l.dot(_ipy)
+            K1r = K1r.dot(_ipy)
         if cs[1] > pi2:
             cs[1] -= 3*pi2
-            K1l.dot(_ipx, out=K1l)
-            K1r.dot(_ipx, out=K1r)
+            K1l = K1l.dot(_ipx)
+            K1r = K1r.dot(_ipx)
         conjs = 0
         if cs[0] > pi4:
             cs[0] = pi2-cs[0]
-            K1l.dot(_ipy, out=K1l)
-            _ipy.dot(K2r, out=K2r)
+            K1l = K1l.dot(_ipy)
+            K2r = _ipy.dot(K2r)
             conjs += 1
         if cs[1] > pi4:
             cs[1] = pi2-cs[1]
-            K1l.dot(_ipx, out=K1l)
-            _ipx.dot(K2r, out=K2r)
+            K1l = K1l.dot(_ipx)
+            K2r = _ipx.dot(K2r)
             conjs += 1
         if cs[2] > pi2:
             cs[2] -= 3*pi2
-            K1l.dot(_ipz, out=K1l)
-            K1r.dot(_ipz, out=K1r)
+            K1l = K1l.dot(_ipz)
+            K1r = K1r.dot(_ipz)
         if conjs == 1:
             cs[2] = pi2-cs[2]
-            K1l.dot(_ipz, out=K1l)
-            _ipz.dot(K2r, out=K2r)
+            K1l = K1l.dot(_ipz)
+            K2r = _ipz.dot(K2r)
         if cs[2] > pi4:
             cs[2] -= pi2
-            K1l.dot(_ipz, out=K1l)
-            K1r.dot(_ipz, out=K1r)
+            K1l = K1l.dot(_ipz)
+            K1r = K1r.dot(_ipz)
         self.a = cs[1]
         self.b = cs[0]
         self.c = cs[2]


Test patch: