def one_over_x_like(x):
    """
    returns -np.Inf if x<0, -np.log(x) otherwise.
    """
    if np.any(x < 0):
        return -np.Inf
    else:
        return -np.sum(np.log(x))
def one_over_x_like ( x ) : if np . any ( x < 0 ) : return - np . Inf else : return - np . sum ( np . log ( x ) )
returns -np.Inf if x<0, -np.log(x) otherwise.