def lpgamma(p, a):
    """
    Multidimensional gamma / partial gamma function

    Parameters
    ----------
    p : int
        something....

    a : float
        something....

    Returns
    -------
    Multidimensional gamma / partial gamma function

    """
    res = p * (p - 1.0) / 4.0 * log(pi)
    for ii in range(1, p+1):
        res += gammaln(a + (1.0 - ii) / 2.0)

    return res