def isvector(arr):
    """Check if a numpy array is a vector-like object."""
    # we are not using `arr.ndims` in case the input is a qutip object
    ndims = len(arr.shape)
    return (ndims == 1
            or (ndims == 2 and (arr.shape[0] == 1 or arr.shape[1] == 1)))