# Buggy code
def norm(self, norm=None, sparse=False, tol=0, maxiter=100000):
    """Norm of a quantum object.

    Default norm is L2-norm for kets and trace-norm for operators.
    Other ket and operator norms may be specified using the
    `ket_norm` and `oper_norm` arguments.

    Parameters
    ----------
    norm : str
        Which norm to use for ket/bra vectors: L2 'l2', max norm 'max',
        or for operators: trace 'tr', Frobius 'fro', one 'one', or max 'max'.

    sparse : bool
        Use sparse eigenvalue solver for trace norm.  Other norms are not
        affected by this parameter.

    tol : float
        Tolerance for sparse solver (if used) for trace norm. The sparse
        solver may not converge if the tolerance is set too low.

    maxiter : int
        Maximum number of iterations performed by sparse solver (if used)
        for trace norm.

    Returns
    -------
    norm : float
        The requested norm of the operator or state quantum object.


    Notes
    -----
    The sparse eigensolver is much slower than the dense version.
    Use sparse only if memory requirements demand it.

    """
    if self.type == "oper" or self.type == "super":
        if norm is None or norm == "tr":
            vals = sp_eigs(self, vecs=False, sparse=sparse, tol=tol, maxiter=maxiter)
            return np.sum(sqrt(abs(vals) ** 2))
        elif norm == "fro":
            return _sp_fro_norm(self)
        elif norm == "one":
            return _sp_one_norm(self)
        elif norm == "max":
            return _sp_max_norm(self)
        else:
            raise ValueError("Operator norm must be 'tr', 'fro', 'one', or 'max'.")
    else:
        if norm == None:
            norm = "l2"
        if norm == "l2":
            return _sp_L2_norm(self)
        elif norm == "max":
            return _sp_max_norm(self)
        else:
            raise ValueError("Ket norm must be 'l2', or 'max'.")


# Traceback (TypeError)
rho_psi = operator_to_vector(Qobj(np.diag(np.array([0.9, 0.1], dtype=complex))))>>> E_psi = rho_psi.dag()
S = to_super(sigmax())
(E_psi * S) * rho_psi
Traceback (most recent call last):
File "<ipython-input-22-90cbfac2a43e>", line 1, in <module>
(E_psi * S) * rho_psi
File "qutip/qobj.py", line 416, in __mul__
raise TypeError("Incompatible Qobj shapes")
TypeError: Incompatible Qobj shapes

E_psi * (S * rho_psi)
Quantum object: dims = [[1], [1]], shape = [1, 1], type = oper, isherm = True
Qobj data =
[[ 0.18]]
E_psi
Quantum object: dims = [[1], [[2], [2]]], shape = [1, 4], type = bra
Qobj data =
[[ 0.9  0.   0.   0.1]]
rho_psi
Quantum object: dims = [[[2], [2]], [1]], shape = [4, 1], type = operator-vector
Qobj data =
[[ 0.9]
[ 0. ]
[ 0. ]
[ 0.1]]
S
Quantum object: dims = [[[2], [2]], [[2], [2]]], shape = [4, 4], type = super, isherm = True
Qobj data =
[[ 0.  0.  0.  1.]
[ 0.  0.  1.  0.]
[ 0.  1.  0.  0.]
[ 1.  0.  0.  0.]]

# Fixed code
def norm(self, norm=None, sparse=False, tol=0, maxiter=100000):
    """Norm of a quantum object.

    Default norm is L2-norm for kets and trace-norm for operators.
    Other ket and operator norms may be specified using the
    `ket_norm` and `oper_norm` arguments.

    Parameters
    ----------
    norm : str
        Which norm to use for ket/bra vectors: L2 'l2', max norm 'max',
        or for operators: trace 'tr', Frobius 'fro', one 'one', or max 'max'.

    sparse : bool
        Use sparse eigenvalue solver for trace norm.  Other norms are not
        affected by this parameter.

    tol : float
        Tolerance for sparse solver (if used) for trace norm. The sparse
        solver may not converge if the tolerance is set too low.

    maxiter : int
        Maximum number of iterations performed by sparse solver (if used)
        for trace norm.

    Returns
    -------
    norm : float
        The requested norm of the operator or state quantum object.


    Notes
    -----
    The sparse eigensolver is much slower than the dense version.
    Use sparse only if memory requirements demand it.

    """
    if self.type in ["oper", "super"]:
        if norm is None or norm == "tr":
            vals = sp_eigs(self, vecs=False, sparse=sparse, tol=tol, maxiter=maxiter)
            return np.sum(sqrt(abs(vals) ** 2))
        elif norm == "fro":
            return _sp_fro_norm(self)
        elif norm == "one":
            return _sp_one_norm(self)
        elif norm == "max":
            return _sp_max_norm(self)
        else:
            raise ValueError("Operator norm must be 'tr', 'fro', 'one', or 'max'.")
    else:
        if norm == None:
            norm = "l2"
        if norm == "l2":
            return _sp_L2_norm(self)
        elif norm == "max":
            return _sp_max_norm(self)
        else:
            raise ValueError("Ket norm must be 'l2', or 'max'.")