Skip to content

Commit 321fb92

Browse files
committed
fix gauss expected grad hess
1 parent 47c8ed2 commit 321fb92

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/algorithms/gauss_expected_grad_hess.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function gaussian_expectation_gradient_and_hessian!(
3535
#
3636
# E_{z ~ N(m, CC')} ∇2 log π(z)
3737
# = E_{z ~ N(m, CC')} (CC')^{-1} (z - m) ∇ log π(z)T
38-
# = E_{u ~ N(0, I)} C \ (u ∇ log π(z)T) .
38+
# = E_{u ~ N(0, I)} C' \ (u ∇ log π(z)T) .
3939
#
4040
# Algorithmically, draw u ~ N(0, I), z = C u + m, where C = q.scale.
4141
# Accumulate A = E[ u ∇ log π(z)T ], then map back: H = C \ A.
@@ -54,7 +54,7 @@ function gaussian_expectation_gradient_and_hessian!(
5454
grad_buf[:] .+= ∇logπ_div_nsamples
5555
hess_buf[:, :] .+= ub*∇logπ_div_nsamples'
5656
end
57-
hess_buf[:, :] .= C \ hess_buf
57+
hess_buf[:, :] .= C' \ hess_buf
5858
return logπ_avg, grad_buf, hess_buf
5959
else
6060
# Second-order: use naive sample average

0 commit comments

Comments
 (0)