liesel-devs / liesel

A probabilistic programming framework
https://liesel-project.org
MIT License
40 stars 2 forks source link

Make MultivariateNormalDegenerate more efficient #99

Closed jobrachem closed 1 year ago

jobrachem commented 1 year ago

In the constructor .from_penalty, we are currently always computing the eigenvalue decomposition of the penalty matrix. This is super inefficient, since the constructor gets called very often and the eigenvalues of the penalty matrix stays constant. What's more, the eigenvalue decomposition is computed even in the case that the user provides the rank and log pseudo-determinant of the penalty matrix manually. In this case, the eigenvalue-decomposition is not even used! The constructor could easily be made more efficient without changing its API by computing the eigenvalue-decomposition ONLY if the rank and log-pseudodeterminant are not provided.