internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: qutip/qutip

Issue:
isherm incorrectly returning True for sigmam() in 3.2.0.dev-
Hey,

It seems the sigmam() operator incorrectly returns True when tested with isherm.

I think this is only an issue in the developer version 3.2.0.dev- (it does not happen with the stable release)

The following code reproduces the issue:

``` python
import qutip as qu

print("My version:")
print(qu.version.version)

mysigmam = qu.basis(2,1) * qu.basis(2,0).dag()
print("My sigmam:")
print(mysigmam)
print("is hermitian?:")
print(mysigmam.isherm)

print("Qutip sigmam:")
print(qu.operators.sigmam())
print("is hermitian?:")
print(qu.operators.sigmam().isherm)
```

Which returns, on my machine:

```
My version:
3.2.0.dev-
My sigmam:
Quantum object: dims = [[2], [2]], shape = [2, 2], type = oper, isherm = False
Qobj data =
[[ 0.  0.]
 [ 1.  0.]]
is hermitian?:
False
Qutip sigmam:
Quantum object: dims = [[2], [2]], shape = [2, 2], type = oper, isherm = True
Qobj data =
[[ 0.  0.]
 [ 1.  0.]]
is hermitian?:
True
```



Discussion:
Indeed it is. It appears that it got hard coded somewhere. Will fix tonight. Thanks for finding this!


Resolving patch:
diff --git a/qutip/operators.py b/qutip/operators.py
--- a/qutip/operators.py
+++ b/qutip/operators.py
@@ -66,7 +66,7 @@ def jmat(j, *args):
 
     Returns
     -------
-    jmat : qobj/list
+    jmat : qobj / ndarray
         ``qobj`` for requested spin operator(s).
 
 
@@ -105,7 +105,7 @@ def jmat(j, *args):
         a1 = Qobj(0.5 * (_jplus(j) + _jplus(j).conj().T))
         a2 = Qobj(0.5 * 1j * (_jplus(j) - _jplus(j).conj().T))
         a3 = Qobj(_jz(j))
-        return [a1, a2, a3]
+        return np.array([a1, a2, a3])
 
     if args[0] == '+':
         A = _jplus(j)
@@ -120,7 +120,7 @@ def jmat(j, *args):
     else:
         raise TypeError('Invalid type')
 
-    return Qobj(A.tocsr(), isherm=True)
+    return Qobj(A.tocsr())
 
 
 def _jplus(j):


Test patch:
Repository: qutip/qutip

Issue:
Floquet lil data fix
Setting of `Qobj.data = lil_matrix` changed


Discussion:

Resolving patch:
diff --git a/qutip/floquet.py b/qutip/floquet.py
--- a/qutip/floquet.py
+++ b/qutip/floquet.py
@@ -705,14 +705,14 @@ def floquet_master_equation_tensor(Alist, f_energies):
         Alist = [Alist]
         N, M = np.shape(Alist[0])
 
-    Rdata_lil = scipy.sparse.lil_matrix((N * N, N * N))
+    Rdata_lil = scipy.sparse.lil_matrix((N * N, N * N), dtype=complex)
     for I in range(N * N):
         a, b = vec2mat_index(N, I)
         for J in range(N * N):
             c, d = vec2mat_index(N, J)
 
-            Rdata_lil[I, J] = -1.0j * (f_energies[a] - f_energies[b]) * \
-                (a == c) * (b == d)
+            R = -1.0j * (f_energies[a] - f_energies[b])*(a == c)*(b == d)
+            Rdata_lil[I, J] = R
 
             for A in Alist:
                 s1 = s2 = 0
@@ -833,7 +833,7 @@ def floquet_markov_mesolve(R, ekets, rho0, tlist, e_ops, f_modes_table=None,
         if not r.successful():
             break
 
-        rho.data = vec2mat(r.y)
+        rho = Qobj(vec2mat(r.y), rho0.dims, rho0.shape)
 
         if expt_callback:
             # use callback method


Test patch:
Repository: qutip/qutip

Issue:
Reverse Circuit doesn't work
Whenever i try to reverse some Circuit it throws an exception telling that temp does not have append method implemented.
I checked the source code and i think that instead o append the developers meant add_gate.


Discussion:
Could you please post the code snippet and the traceback of the error message ? Thank you.
Ok. I wrote a test for it. The error message can be seen below. I will open a PR to resolve this. Thank you very much for raising the issue.
```
qc = QubitCircuit(3)
qc.add_gate("CNOT", targets=[1], controls=[0])
test_gate = Gate("RZ", targets=[1], arg_value = 1.570796,
                             arg_label="P")
qc.add_gate(test_gate)
qc.reverse_circuit()
```

```
ERROR: Reverse a circuit
----------------------------------------------------------------------
Traceback (most recent call last):
dev/qutip/qutip/qip/circuit.py", line 371, in reverse_circuit
    temp.append(self.gates[self.N - i - 1])
AttributeError: 'QubitCircuit' object has no attribute 'append'
```

Resolving patch:
diff --git a/qutip/qip/circuit.py b/qutip/qip/circuit.py
--- a/qutip/qip/circuit.py
+++ b/qutip/qip/circuit.py
@@ -367,8 +367,8 @@ def reverse_circuit(self):
         """
         temp = QubitCircuit(self.N, self.reverse_states)
 
-        for i in range(self.N):
-            temp.append(self.gates[self.N - i - 1])
+        for gate in reversed(self.gates):
+            temp.add_gate(gate)
 
         return temp
 


Test patch:
diff --git a/qutip/tests/test_qubitcircuit.py b/qutip/tests/test_qubitcircuit.py
--- a/qutip/tests/test_qubitcircuit.py
+++ b/qutip/tests/test_qubitcircuit.py
@@ -171,8 +171,6 @@ def test_add_state(self):
         assert_(qc.input_states[0] == "0")
         assert_(qc.input_states[2] == None)
         assert_(qc.output_states[1] == "+")
-        assert_(qc.output_states[1] == "+")
-        assert_(qc.output_states[2] == None)
 
         qc1 = QubitCircuit(10)
 
@@ -196,5 +194,31 @@ def test_add_state(self):
 
         assert_(qc1.output_states[0] == "beta")
 
+    def test_reverse(self):
+        """
+        Reverse a quantum circuit
+        """
+        qc = QubitCircuit(3)
+
+        qc.add_gate("RX", targets=[0], arg_value=3.141,
+                    arg_label=r"\pi/2")
+        qc.add_gate("CNOT", targets=[1], controls=[0])
+        qc.add_gate("SNOT", targets=[2])
+        # Keep input output same
+
+        qc.add_state("0", targets=[0])
+        qc.add_state("+", targets=[1], state_type="output")
+        qc.add_state("-", targets=[1])
+
+        qc.reverse_circuit()
+
+        assert_(qc.gates[2].name == "SNOT")
+        assert_(qc.gates[1].name == "CNOT")
+        assert_(qc.gates[0].name == "RX")
+
+        assert_(qc.input_states[0] == "0")
+        assert_(qc.input_states[2] == None)
+        assert_(qc.output_states[1] == "+")
+
 if __name__ == "__main__":
     run_module_suite()
Repository: qutip/qutip

Issue:
Fixes #746: Trace norm for non-herm
This is the most naive way perhaps to do this. But since it uses Qobj functions to do it I am guessing it is the most efficient and takes into consideration sparse matrices etc.

@ajgpitch 


Discussion:

Resolving patch:
diff --git a/qutip/qobj.py b/qutip/qobj.py
--- a/qutip/qobj.py
+++ b/qutip/qobj.py
@@ -953,9 +953,10 @@ def norm(self, norm=None, sparse=False, tol=0, maxiter=100000):
         """
         if self.type in ['oper', 'super']:
             if norm is None or norm == 'tr':
-                vals = sp_eigs(self.data, self.isherm, vecs=False,
+                _op = self*self.dag()
+                vals = sp_eigs(_op.data, _op.isherm, vecs=False,
                                sparse=sparse, tol=tol, maxiter=maxiter)
-                return np.sum(sqrt(abs(vals) ** 2))
+                return np.sum(np.sqrt(np.abs(vals)))
             elif norm == 'fro':
                 return sp_fro_norm(self.data)
             elif norm == 'one':


Test patch:
diff --git a/qutip/tests/test_cqed.py b/qutip/tests/test_cqed.py
--- a/qutip/tests/test_cqed.py
+++ b/qutip/tests/test_cqed.py
@@ -99,7 +99,7 @@ def test_dispersivecqed_combination(self):
         U_physical = gate_sequence_product(U_list)
 
         print((U_ideal - U_physical).norm())
-        assert_((U_ideal - U_physical).norm() < 1e-3)
+        assert_((U_ideal - U_physical).norm() < 1e-2)
 
 
 if __name__ == "__main__":
diff --git a/qutip/tests/test_qobj.py b/qutip/tests/test_qobj.py
--- a/qutip/tests/test_qobj.py
+++ b/qutip/tests/test_qobj.py
@@ -582,7 +582,11 @@ def test_QobjNorm():
     A = Qobj(x)
     assert_equal(
         np.abs(A.norm('fro') - la.norm(A.full(), 'fro')) < 1e-12, True)
-
+    # operator trace norm
+    a = rand_herm(10,0.25)
+    assert_almost_equal(a.norm(), (a*a.dag()).sqrtm().tr().real)
+    b = rand_herm(10,0.25) - 1j*rand_herm(10,0.25)
+    assert_almost_equal(b.norm(), (b*b.dag()).sqrtm().tr().real)
 
 def test_QobjPermute():
     "Qobj permute"
Repository: qutip/qutip

Issue:
HEOM solver bug for a tensor product of systems: requires a change of dimensions
In the construction of the RHS of the equation for the Hierarchy Equations of Motion (`non_markov/heom`) there is a bug found by @nwlambert . If the 'system' is actually a tensor product of systems it fails as the dimensions are incorrect. This can be fixed by changing the construction of the RHS in `non_markov/heom.py` (line 310) from

```
sup_dim = H_sys.dims[0][0]**2
unit_sys = qeye(H_sys.dims[0])
```
to

```
N_temp = reduce(mul, H_sys.dims[0], 1)
sup_dim = N_temp**2
unit_sys = qeye(N_temp)
```

I will open a PR to do the same. Just raising the issue so that it is documented and helps others find the problem in the previous versions.


Discussion:

Resolving patch:
diff --git a/qutip/nonmarkov/heom.py b/qutip/nonmarkov/heom.py
--- a/qutip/nonmarkov/heom.py
+++ b/qutip/nonmarkov/heom.py
@@ -307,8 +307,12 @@ def configure(self, H_sys, coup_op, coup_strength, temperature,
             if stats:
                 stats.add_message('options', 'renormalisation', ss_conf)
         # Dimensions et by system
-        sup_dim = H_sys.dims[0][0]**2
-        unit_sys = qeye(H_sys.dims[0])
+        N_temp = 1
+        for i in H_sys.dims[0]:
+            N_temp *= i
+        sup_dim = N_temp**2
+        unit_sys = qeye(N_temp)
+
 
         # Use shorthands (mainly as in referenced PRL)
         lam0 = self.coup_strength


Test patch:
Repository: qutip/qutip

Issue:
Visualization of density matrix via `visualization.hinton` doesn't work with subplots
Consider the following MWE:

```
import matplotlib.pyplot as plt
%matplotlib notebook
import qutip
fig, axs = plt.subplots(1, 2)
dm1 = qutip.ket2dm(qutip.basis(2, 0))
dm2 = qutip.ket2dm(qutip.basis(2, 1))

qutip.visualization.hinton(dm1, ax=axs[0]);
qutip.visualization.hinton(dm2, ax=axs[1]);
```

The result is the following:
![capture](https://user-images.githubusercontent.com/10957113/36647070-efeab558-1a77-11e8-93d9-8f1bd3abc5e3.PNG)

I'm guessing this should work? Or should I do this kind of plotting differently?


Discussion:
Hi, you're right. The `_blob` function should take the axis handle. Opening a PR for the same. Is this what you expected btw ?

![screenshot 2018-02-26 13 06 39](https://user-images.githubusercontent.com/6968324/36653049-0b69fe14-1af6-11e8-8e53-b228638e68b5.png)


Resolving patch:
diff --git a/qutip/visualization.py b/qutip/visualization.py
--- a/qutip/visualization.py
+++ b/qutip/visualization.py
@@ -70,7 +70,7 @@
 
 
 # Adopted from the SciPy Cookbook.
-def _blob(x, y, w, w_max, area, cmap=None):
+def _blob(x, y, w, w_max, area, cmap=None, ax=None):
     """
     Draws a square-shaped blob with the given area (< 1) at
     the given coordinates.
@@ -79,7 +79,12 @@ def _blob(x, y, w, w_max, area, cmap=None):
     xcorners = array([x - hs, x + hs, x + hs, x - hs])
     ycorners = array([y - hs, y - hs, y + hs, y + hs])
 
-    plt.fill(xcorners, ycorners,
+    if ax is not None:
+        handle = ax
+    else:
+        handle = plt
+
+    handle.fill(xcorners, ycorners,
              color=cmap(int((w + w_max) * 256 / (2 * w_max))))
 
 
@@ -226,10 +231,10 @@ def hinton(rho, xlabels=None, ylabels=None, title=None, ax=None, cmap=None,
             _y = y + 1
             if np.real(W[x, y]) > 0.0:
                 _blob(_x - 0.5, height - _y + 0.5, abs(W[x,
-                      y]), w_max, min(1, abs(W[x, y]) / w_max), cmap=cmap)
+                      y]), w_max, min(1, abs(W[x, y]) / w_max), cmap=cmap, ax=ax)
             else:
                 _blob(_x - 0.5, height - _y + 0.5, -abs(W[
-                      x, y]), w_max, min(1, abs(W[x, y]) / w_max), cmap=cmap)
+                      x, y]), w_max, min(1, abs(W[x, y]) / w_max), cmap=cmap, ax=ax)
 
     # color axis
     norm = mpl.colors.Normalize(-abs(W).max(), abs(W).max())


Test patch:
Repository: qutip/qutip

Issue:
Incorrect docstring of spin coherent state
In qutip.states the docstring of the `spin_coherent` state is the same of `spin_state`. The correct description should be: "Generate the coherent spin state |theta, phi>."


Discussion:

Resolving patch:
diff --git a/qutip/states.py b/qutip/states.py
--- a/qutip/states.py
+++ b/qutip/states.py
@@ -1060,8 +1060,7 @@ def spin_state(j, m, type='ket'):
 
 
 def spin_coherent(j, theta, phi, type='ket'):
-    """Generates the spin state |j, m>, i.e.  the eigenstate
-    of the spin-j Sz operator with eigenvalue m.
+    """Generate the coherent spin state |theta, phi>.
 
     Parameters
     ----------


Test patch:
Repository: qutip/qutip

Issue:
qdiag throws incorrect error
Hi all

When I ran this code

```python
import qutip as q
q.qdiags(q.basis(3, 0), 0)
````

The error that was thrown indicated an improper version of Scipy instead of an error associated with
the function itself. I think it's because the [exception clause here](https://github.com/qutip/qutip/blob/master/qutip/operators.py#L753) is too broad. I think it should be catching ``NameError``.


Discussion:

Resolving patch:
diff --git a/qutip/operators.py b/qutip/operators.py
--- a/qutip/operators.py
+++ b/qutip/operators.py
@@ -717,6 +717,7 @@ def qdiags(diagonals, offsets, dims=None, shape=None):
     ----------
     diagonals : sequence of array_like
         Array of elements to place along the selected diagonals.
+
     offsets : sequence of ints
         Sequence for diagonals to be set:
             - k=0 main diagonal
@@ -724,6 +725,7 @@ def qdiags(diagonals, offsets, dims=None, shape=None):
             - k<0 kth lower diagonal
     dims : list, optional
         Dimensions for operator
+
     shape : list, tuple, optional
         Shape of operator.  If omitted, a square operator large enough
         to contain the diagonals is generated.
@@ -738,7 +740,7 @@ def qdiags(diagonals, offsets, dims=None, shape=None):
 
     Examples
     --------
-    >>> qdiags(sqrt(range(1,4)),1)
+    >>> qdiags(sqrt(range(1, 4)), 1)
     Quantum object: dims = [[4], [4]], \
 shape = [4, 4], type = oper, isherm = False
     Qobj data =
@@ -748,10 +750,7 @@ def qdiags(diagonals, offsets, dims=None, shape=None):
      [ 0.          0.          0.          0.        ]]
 
     """
-    try:
-        data = sp.diags(diagonals, offsets, shape, format='csr', dtype=complex)
-    except:
-        raise NotImplementedError("This function requires SciPy 0.11+.")
+    data = sp.diags(diagonals, offsets, shape, format='csr', dtype=complex)
     if not dims:
         dims = [[], []]
     if not shape:


Test patch:
Repository: qutip/qutip

Issue:
enr_fock is broken
enr_fock is incompatible with enr_destroy.

Minimal code:
```
x = enr_destroy([3,3],2)
y = enr_fock([3,3],2,[1,1])
x[0]*y
```
returns an error.

I believe the problem is that the problem is that y has dim = [[3, 3], 1] instead of dim = [[3, 3], [1,1]].


Discussion:
I am still trying to understand the error:
Perhaps the pending notebook
https://github.com/qutip/qutip-notebooks/pull/51
could help you

As I said, I think this is about the dims property. If you try,
```
x = enr_destroy([3,3],2)
z = x[0].eigenstates()[1][0]
y = enr_fock([3,3],2,[1,1])
print(z.dims)
print(y.dims)
```
you see they are incompatible:
```
[[3, 3], [1, 1]]
[[3, 3], 1]
```

Meanwhile, if you adjust dims, the multiplication works out ok:
```
y.dims[1] = [1,1]
x[0]*y
```
yields the correct result.

Resolving patch:
diff --git a/qutip/states.py b/qutip/states.py
--- a/qutip/states.py
+++ b/qutip/states.py
@@ -927,7 +927,7 @@ def enr_fock(dims, excitations, state):
         raise ValueError("The state tuple %s is not in the restricted "
                          "state space" % str(tuple(state)))
 
-    return Qobj(data, dims=[dims, 1])
+    return Qobj(data, dims=[dims, [1]*len(dims)])
 
 
 def enr_thermal_dm(dims, excitations, n):


Test patch:
Repository: qutip/qutip

Issue:
Optimization flags in setup.py should be completely avoided
Hard-coding compiler flag `-march=native` in setup.py completely destroys possibility to set up Qutip on heterogeneous cluster. In general, it brings a lot of problems for people that don't have a good experience in debugging "illegal instruction" errors, that often happen, if you compile the module on different machine than you use.

If you are sure you need optimized build for localhost, you might use
```
export CFLAGS="-O3 -march=native"
export CXXFLAGS="$CFLAGS"
pip install qutip
```
instead or provide separate option for setup.py script.


Discussion:
Might this be the cause of https://github.com/qutip/qutip/issues/674?
I am almost certain that this is the reason.

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -159,7 +159,7 @@ def write_version_py(filename='qutip/version.py'):
     _compiler_flags = ['/w', '/Ox']
 # Everything else
 else:
-    _compiler_flags = ['-w', '-O3', '-march=native', '-funroll-loops']
+    _compiler_flags = ['-w', '-O3', '-funroll-loops']
     if sys.platform == 'darwin':
         # These are needed for compiling on OSX 10.14+
         _compiler_flags.append('-mmacosx-version-min=10.9')


Test patch:
Repository: qutip/qutip

Issue:
Integer overflow on windows
The following error occurred several times while running the tests on my machine:
```
======================================================================
ERROR: Stochastic: ssesolve: heterodyne, time-dependent H
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\Boxi\Miniconda3\envs\qutip-dev-py3\lib\site-packages\nose\case.py", line 197, in runTest
    self.test(*self.arg)
  File "C:\Users\Boxi\OneDrive\Studium\qutip-project\qutip\qutip\tests\test_stochastic_se.py", line 208, in test_ssesolve_heterodyne
    map_func=parallel_map, args={"a":2})
  File "C:\Users\Boxi\OneDrive\Studium\qutip-project\qutip\qutip\stochastic.py", line 698, in ssesolve
    args=args, **kwargs)
  File "C:\Users\Boxi\OneDrive\Studium\qutip-project\qutip\qutip\stochastic.py", line 417, in __init__
    self.noise = np.random.randint(0, 2**32, ntraj).astype("u4")
  File "mtrand.pyx", line 990, in mtrand.RandomState.randint
ValueError: high is out of bounds for int32

----------------------------------------------------------------------
```
It is due to the fact that the default integer of python on windows is int32 instead of int64. `np.random.randint(0, 2**32)` produces the same error on my machine. Maybe it is better to add `dtype=np.int64` or `dtype=np.uint32` since they are platform independent. If you agree I can work on fixing it.


Discussion:
Thank you for finding the source to this testing error and proposing a fix. It would be best to have @Ericgig's opinion on this, as he refurbished the stochastic solvers and has been working on migration from int32 to int64, see also project [4](https://github.com/qutip/qutip/wiki//Google-Summer-of-Code-2019#4-abstraction-of-the-quantum-object-class-qutipqobjqobj) in Google Summer of Code. 
It needs to be 2^32-1
Or better yer np.iinfo(np.int32).max
Thank you for finding it. You can make a patch if you have time. nonhermitian's `np.iinfo(np.int32).max` seems the best solution. seeds should be `dtype=np.uint32`
@BoxiLi nice work, thanks

Resolving patch:
diff --git a/qutip/stochastic.py b/qutip/stochastic.py
--- a/qutip/stochastic.py
+++ b/qutip/stochastic.py
@@ -382,7 +382,7 @@ def __init__(self, me, H=None, c_ops=[], sc_ops=[], state0=None,
             if isinstance(noise, int):
                 # noise contain a seed
                 np.random.seed(noise)
-                noise = np.random.randint(0, 2**32, ntraj)
+                noise = np.random.randint(0, np.iinfo(np.uint32).max, ntraj, dtype=np.uint32)
             noise = np.array(noise)
             if len(noise.shape) == 1:
                 if noise.shape[0] < ntraj:
@@ -414,7 +414,7 @@ def __init__(self, me, H=None, c_ops=[], sc_ops=[], state0=None,
                 self.noise = noise
 
         else:
-            self.noise = np.random.randint(0, 2**32, ntraj).astype("u4")
+            self.noise = np.random.randint(0, np.iinfo(np.int32).max, ntraj, dtype=np.uint32)
             self.noise_type = 0
 
         # Map


Test patch:
Repository: qutip/qutip

Issue:
Installation of qutip shows various warnings on ubuntu 20.04.1
**Describe the bug**
Installing the qutip on ubuntu 20.04.1 shows the following warnings:
```
$ sudo apt install python3-qutip 
…
Entpacken von python3-qutip (4.4.1-6build1) ...
python3-qutip (4.4.1-6build1) wird eingerichtet ...
/usr/lib/python3/dist-packages/qutip/_mkl/spmv.py:53: SyntaxWarning: "is" 
with a literal. Did you mean "=="?
  if x.ndim is 1:
/usr/lib/python3/dist-packages/qutip/qobjevo.py:776: SyntaxWarning: "is no
t" with a literal. Did you mean "!="?
  if self.compiled and self.compiled.split()[2] is not "cte":
/usr/lib/python3/dist-packages/qutip/qobjevo.py:1045: SyntaxWarning: "is" 
with a literal. Did you mean "=="?
  elif op1.type is "array":
/usr/lib/python3/dist-packages/qutip/qobjevo.py:1070: SyntaxWarning: "is" 
with a literal. Did you mean "=="?
  elif self.ops[_set[0]].type is "string":
/usr/lib/python3/dist-packages/qutip/qobjevo.py:1079: SyntaxWarning: "is" 
with a literal. Did you mean "=="?
  elif self.ops[_set[0]].type is "array":
/usr/lib/python3/dist-packages/qutip/qobjevo.py:1534: SyntaxWarning: "is n
ot" with a literal. Did you mean "!="?
  for key in self.__dict__ if key is not "compiled_qobjevo"}
```


**To Reproduce**
Install qutip on ubuntu 20.04.1 via `sudo apt install python3-qutip`.

**Expected behavior**
No warnings during the installation of qutip.

**Your Environment**
```
>>> qutip.about()

QuTiP: Quantum Toolbox in Python
================================
Copyright (c) QuTiP team 2011 and later.
Original developers: R. J. Johansson & P. D. Nation.
Current admin team: Alexander Pitchford, Paul D. Nation, Nathan Shammah, Shahnawaz Ahmed, Neill Lambert, and Eric Giguère.
Project Manager: Franco Nori.
Currently developed through wide collaboration. See https://github.com/qutip for details.

QuTiP Version:      4.4.1
Numpy Version:      1.17.4
Scipy Version:      1.4.1
Cython Version:     0.29.14
Matplotlib Version: 3.1.2
Python Version:     3.8.5
Number of CPUs:     2
BLAS Info:          OPENBLAS
OPENMP Installed:   True
INTEL MKL Ext:      False
Platform Info:      Linux (x86_64)
Installation path:  /usr/lib/python3/dist-packages/qutip
```


Discussion:

Resolving patch:
diff --git a/qutip/_mkl/spmv.py b/qutip/_mkl/spmv.py
--- a/qutip/_mkl/spmv.py
+++ b/qutip/_mkl/spmv.py
@@ -50,7 +50,7 @@ def mkl_spmv(A, x):
      indices = A.indices.ctypes.data_as(POINTER(c_int))
 
      # Allocate output, using same conventions as input
-     if x.ndim is 1:
+     if x.ndim == 1:
         y = np.empty(m,dtype=np.complex,order='C')
      elif x.ndim==2 and x.shape[1]==1:
         y = np.empty((m,1),dtype=np.complex,order='C')


Test patch: