def sign_split(M):
    """Given a matrix M, return two matrices.  The first contains the
       positive entries of M; the second contains the negative entries of M,
       multiplied by -1.
    """
    M_plus  =  M*(M>0).astype(int)
    M_minus = -M*(M<0).astype(int)
    return M_plus, M_minus