Automatic Differentiation
 
Loading...
Searching...
No Matches

◆ lmgamma() [2/4]

template<typename T , require_arithmetic_t< T > * = nullptr>
return_type_t< T > stan::math::lmgamma ( int  k,
x 
)
inline

Return the natural logarithm of the multivariate gamma function with the specified dimensions and argument.

The multivariate gamma function \(\Gamma_k(x)\) for dimensionality \(k\) and argument \(x\) is defined by

\(\Gamma_k(x) = \pi^{k(k-1)/4} \, \prod_{j=1}^k \Gamma(x + (1 - j)/2)\),

where \(\Gamma()\) is the gamma function.

\[ \mbox{lmgamma}(n, x) = \begin{cases} \textrm{error} & \mbox{if } x\in \{\dots, -3, -2, -1, 0\}\\ \ln\Gamma_n(x) & \mbox{if } x\not\in \{\dots, -3, -2, -1, 0\}\\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{lmgamma}(n, x)}{\partial x} = \begin{cases} \textrm{error} & \mbox{if } x\in \{\dots, -3, -2, -1, 0\}\\ \frac{\partial\, \ln\Gamma_n(x)}{\partial x} & \mbox{if } x\not\in \{\dots, -3, -2, -1, 0\}\\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \ln\Gamma_n(x) = \pi^{n(n-1)/4} \, \prod_{j=1}^n \Gamma(x + (1 - j)/2) \]

\[ \frac{\partial \, \ln\Gamma_n(x)}{\partial x} = \sum_{j=1}^n \Psi(x + (1 - j) / 2) \]

Template Parameters
Ttype of scalar
Parameters
kNumber of dimensions.
xFunction argument.
Returns
Natural log of the multivariate gamma function.

Definition at line 55 of file lmgamma.hpp.