Skip to content

Commit

Permalink
Simplify logabsdet evaluation of scale_tril.
Browse files Browse the repository at this point in the history
  • Loading branch information
tillahoffmann committed May 13, 2024
1 parent 9ad4ea9 commit 9737b27
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion numpyro/distributions/continuous.py
Original file line number Diff line number Diff line change
@@ -2710,7 +2710,8 @@ def infer_shapes(
def entropy(self):
p = self.event_shape[-1]
return (
(p + 1) * jnp.linalg.slogdet(self.scale_tril).logabsdet
(p + 1)
* jnp.log(jnp.diagonal(self.scale_tril, axis1=-1, axis2=-2)).sum(axis=-1)
+ p * (p + 1) / 2 * jnp.log(2)
+ multigammaln(self.concentration / 2, p)
- (self.concentration - p - 1) / 2 * multidigamma(self.concentration / 2, p)

0 comments on commit 9737b27

Please sign in to comment.