Skip to content
fn

multigammaln

→Tensor
multigammaln(input: Tensor, p: int)

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

inputTensor
Real argument; any floating-point dtype. Each entry must satisfy a>(p−1)/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 input, same shape and dtype as input.

Notes

Definition:

log⁡Γp(a)=p(p−1)4 log⁡π+∑i=1plog⁡Γ ⁣(a+1−i2).\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 and TypeError if p is not an integer (a float or a bool), as the reference does.

Examples

>>> import lucid
>>> from lucid.special import multigammaln
>>> multigammaln(lucid.tensor([3.0, 5.0]), p=2)
tensor([1.55, 6.204])

Used by 1