fn

multigammaln

Tensor
multigammaln(a: Tensor, p: int)
source

Logarithm of the multivariate gamma function Γp(a)\Gamma_p(a).

Computes logΓp(a)\log \Gamma_p(a), the natural generalisation of lgamma that appears in the normalising constants of the Wishart and inverse-Wishart distributions over positive-definite matrices, and in matrix-Bayes log-evidence formulas.

Parameters

aTensor
Real argument; any floating-point dtype. Each entry must satisfy a>(p1)/2a > (p - 1)/2 for the function to be finite (otherwise the underlying lgamma returns inf).
pint
Dimensionality of the matrix argument; must be a positive integer.

Returns

Tensor

logΓp(a)\log \Gamma_p(a) element-wise over a, same shape and dtype as a.

Notes

Definition:

logΓp(a)=p(p1)4logπ+i=1plogΓ ⁣(a+1i2).\log \Gamma_p(a) = \frac{p(p-1)}{4}\,\log \pi + \sum_{i=1}^{p} \log \Gamma\!\left(a + \frac{1 - i}{2} \right).

For p = 1 this reduces to logΓ(a)\log \Gamma(a). Raises ValueError if p < 1.

Examples

>>> import lucid
>>> from lucid.special import multigammaln
>>> multigammaln(lucid.tensor([3.0, 5.0]), p=2)
Tensor([1.7918, 5.4538])