def gen_dlog_gamma (shape, scale):
    # gamma : G(a)/b^a * x^(a-1) * exp(x/b)
    """Returns a function that gives the derivative of the gamma log-density with respect to X."""
    def fn(x): 
        ret = ((shape-1.0)/x) - (1.0/scale)
        return ret
    return fn