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
Would it be impossible to extend this package to work with Distributions.MvNormalCanon?
I realize one could take the precision matrix of an MvNormalCanon distribution, invert it and create a MvNormal distribution, but it feels like that may be missing out on some computational efficiencies that could be taken advantage of given we already know the precision matrix.
The text was updated successfully, but these errors were encountered:
If you know how easy to get cholesky factor of correlation matrix that correspond to covariance matrix from precision matrix - it can be possible from the firs view. I'll try to think about it.
Given the cholesky decomposition of the precision matrix, how about something like the following to get the cholesky decomposition of the corresponding covariance matrix:
P= [4. 12. -16.; 12. 37. -43.; -16. -43. 98.] # Precision matrix
C = cholesky(P)
R = zeros(size(P)) #Allocate for the cholesky decomposition of the covariance matrix
n = size(P,1)
for l=n:-1:1
R[l,l] = sqrt(sum(C.U[1:l,l].^2)-sum(R[l,l+1:n].^2))
for j=l:-1:1
R[j,l] = (sum(C.U[1:j,l].*C.U[1:j,j]) - sum(R[l,l+1:n].*R[j,l+1:n]))/R[l,l]
end
end
r = inv(R)
# check
b = cholesky(Hermitian(inv(P)))
isapprox(r,Matrix(b.U); rtol = 0.001)
Would it be impossible to extend this package to work with Distributions.MvNormalCanon?
I realize one could take the precision matrix of an MvNormalCanon distribution, invert it and create a MvNormal distribution, but it feels like that may be missing out on some computational efficiencies that could be taken advantage of given we already know the precision matrix.
The text was updated successfully, but these errors were encountered: