diff --git a/src/Models/glauber/glauber_bp.jl b/src/Models/glauber/glauber_bp.jl index 6a5281ec..706159f2 100644 --- a/src/Models/glauber/glauber_bp.jl +++ b/src/Models/glauber/glauber_bp.jl @@ -168,4 +168,4 @@ function (wᵢ::IntegerGlauberFactor)(xᵢᵗ⁺¹::Integer, xₙᵢᵗ::Abstrac βhⱼᵢ = β*(hᵗ + h) E = - potts2spin(xᵢᵗ⁺¹) * βhⱼᵢ return 1 / (1 + exp(2E)) -end \ No newline at end of file +end diff --git a/src/recursive_bp_factor.jl b/src/recursive_bp_factor.jl index 33fbceeb..7b5bc175 100644 --- a/src/recursive_bp_factor.jl +++ b/src/recursive_bp_factor.jl @@ -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 @@ -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) * @@ -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ᵢᵗ) \ No newline at end of file +prob_y0(wᵢ::DampedFactor, y, xᵢᵗ) = prob_y0(wᵢ.w, y, xᵢᵗ)