You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Suppose a user has a Cholesky decomposition of a matrix R and a vector of positive entries σ and wishes to create Σ = PDMat(cholesky(σ .* Matrix(R) .* σ')). This is common in Bayesian inference. e.g. a Cholesky factor of a correlation matrix is drawn from a LKJCholesky distribution, while a vector of standard deviations is drawn from some other distribution, and one wants to construct the Cholesky factorization of the covariance matrix for use in MvNormal.
This can be done much more efficiently with Σ = PDMat(Cholesky(R.uplo == 'U' ? R.U * Diagonal(σ) : Diagonal(σ) * R.L, R.uplo, 0)). But this is still quite long. It would be ideal to have either a constructor for PDMat or some other utility function like the following:
Suppose a user has a
Cholesky
decomposition of a matrixR
and a vector of positive entriesσ
and wishes to createΣ = PDMat(cholesky(σ .* Matrix(R) .* σ'))
. This is common in Bayesian inference. e.g. a Cholesky factor of a correlation matrix is drawn from aLKJCholesky
distribution, while a vector of standard deviations is drawn from some other distribution, and one wants to construct the Cholesky factorization of the covariance matrix for use inMvNormal
.This can be done much more efficiently with
Σ = PDMat(Cholesky(R.uplo == 'U' ? R.U * Diagonal(σ) : Diagonal(σ) * R.L, R.uplo, 0))
. But this is still quite long. It would be ideal to have either a constructor forPDMat
or some other utility function like the following:See also discussions in JuliaStats/Distributions.jl#1336 and TuringLang/Turing.jl#1629 (comment).
The text was updated successfully, but these errors were encountered: