def ketbra(i, j, Ne):
    """This function returns the outer product :math:`|i><j|` where\
 :math:`|i>` and :math:`|j>` are elements of the canonical basis of an\
 Ne-dimensional Hilbert space (in matrix form).

    >>> ketbra(2, 3, 3)
    Matrix([
    [0, 0, 0],
    [0, 0, 1],
    [0, 0, 0]])

    """
    return ket(i, Ne)*bra(j, Ne)