Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
abraunst committed Feb 21, 2024
1 parent ffd5aee commit 3d0990d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Models/glauber/glauber_bp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -168,4 +168,4 @@ function (wᵢ::IntegerGlauberFactor)(xᵢᵗ⁺¹::Integer, xₙᵢᵗ::Abstrac
βhⱼᵢ = β*(hᵗ + h)
E = - potts2spin(xᵢᵗ⁺¹) * βhⱼᵢ
return 1 / (1 + exp(2E))
end
end
6 changes: 3 additions & 3 deletions src/recursive_bp_factor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ prob_xy(wᵢ::RecursiveBPFactor, yₖ, xₖ, xᵢ, dᵢ) = prob_xy(wᵢ, yₖ, x
"P(yₐᵦ|yₐ,yᵦ,xᵢᵗ)"
prob_yy(wᵢ::RecursiveBPFactor, y, y1, y2, xᵢ, d1, d2) = prob_yy(wᵢ::RecursiveBPFactor, y, y1, y2, xᵢ)
prob_yy(wᵢ::RecursiveBPFactor, y, y1, y2, xᵢ) = error("Not implemented")
prob_y0(wᵢ::RecursiveBPFactor, y, xᵢᵗ)::Float64 = y == 1
prob_y0(wᵢ::RecursiveBPFactor, y, xᵢᵗ) = y == 1

##############################################
#### the next methods are optional
Expand All @@ -32,7 +32,7 @@ prob_y0(wᵢ::RecursiveBPFactor, y, xᵢᵗ)::Float64 = y == 1
function (wᵢ::RecursiveBPFactor)(xᵢᵗ⁺¹::Integer, xₙᵢᵗ::AbstractVector{<:Integer},
xᵢᵗ::Integer)
d = length(xₙᵢᵗ)
Pyy = [prob_y0(wᵢ, y, xᵢᵗ) for y in 1:nstates(wᵢ,0)]
Pyy = [float(prob_y0(wᵢ, y, xᵢᵗ)) for y in 1:nstates(wᵢ,0)]
for k in 1:d
Pyy = [sum(prob_yy(wᵢ, y, y1, y2, xᵢᵗ, 1, k-1) *
prob_xy(wᵢ, y1, xₙᵢᵗ[k], xᵢᵗ, k) *
Expand Down Expand Up @@ -195,4 +195,4 @@ function prob_y(wᵢ::DampedFactor, xᵢᵗ⁺¹, xᵢᵗ, yᵗ, d)
return (1-wᵢ.p)*(prob_y(wᵢ.w, xᵢᵗ⁺¹, xᵢᵗ, yᵗ, d)) + wᵢ.p*(xᵢᵗ⁺¹ == xᵢᵗ)
end

prob_y0(wᵢ::DampedFactor, y, xᵢᵗ) = prob_y0(wᵢ.w, y, xᵢᵗ)
prob_y0(wᵢ::DampedFactor, y, xᵢᵗ) = prob_y0(wᵢ.w, y, xᵢᵗ)

0 comments on commit 3d0990d

Please sign in to comment.