Cholesky root
haoliuhl opened this issue · 2 comments
haoliuhl commented
Hi, @chi-feng, i have a question:
We know equation log(det(A)) = 2*sum(log(vecdiag(R)))
is true, where A be your matrix and R = root(A) be the Cholesky root of the matrix A, but in line 30 of Multivariate.js, we see this.logDet = this.covL.diagonal().map(Math.log).sum();
, no need to multiply a constant 2 here?
Thanks.
chi-feng commented
In Eq. 1 there is a 1/2 in front of the log determinant term of the log density due to the -sqrt in the normalizing factor. The logDet
variable refers to the entire term, including the factor 1/2, which cancels with factor of 2 in the log determinant identity.
lhao499 commented
Oh, got it. Thanks!