Skip to content

Commit 6a8d4b9

Browse files
committed
Renormalize messages against themselves first
1 parent f88b21c commit 6a8d4b9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/caches/beliefpropagationcache.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,8 +325,10 @@ function normalize_messages(bp_cache::BeliefPropagationCache, pes::Vector{<:Part
325325
bp_cache = copy(bp_cache)
326326
mts = messages(bp_cache)
327327
for pe in pes
328-
n = region_scalar(bp_cache, pe)
329328
me, mer = only(mts[pe]), only(mts[reverse(pe)])
329+
set!(mts, pe, ITensor[me / norm(me)])
330+
set!(mts, reverse(pe), ITensor[mer / norm(mer)])
331+
n = region_scalar(bp_cache, pe)
330332
set!(mts, pe, ITensor[(1 / sqrt(n)) * me])
331333
set!(mts, reverse(pe), ITensor[(1 / sqrt(n)) * mer])
332334
end

0 commit comments

Comments
 (0)