Skip to content

Commit

Permalink
small optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
abraunst committed Feb 16, 2024
1 parent 35613d8 commit d927a86
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/bp_core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ function f_bp(A::Vector{M2}, wᵢ::Vector{U}, ϕᵢ::Vector{Vector{F}},
xₙᵢᵗ = [xₙᵢ₋ⱼᵗ[1:j_index-1]..., xⱼᵗ, xₙᵢ₋ⱼᵗ[j_index:end]...]
w *= wᵢ[t](xᵢᵗ⁺¹, xₙᵢᵗ, xᵢᵗ)
end
Bᵗ[:, :, xᵢᵗ, xⱼᵗ, xᵢᵗ⁺¹] .+= Aᵗ .* w
if !iszero(w)
Bᵗ[:, :, xᵢᵗ, xⱼᵗ, xᵢᵗ⁺¹] .+= Aᵗ .* w
end
end
end
end
Expand Down Expand Up @@ -76,7 +78,9 @@ function f_bp_dummy_neighbor(A::Vector{<:AbstractMPEM2},
if t <= T || periodic
w *= wᵢ[t](xᵢᵗ⁺¹, collect(xₙᵢᵗ), xᵢᵗ)
end
Bᵗ[:, :, xᵢᵗ, 1, xᵢᵗ⁺¹] .+= Aᵗ .* w
if !iszero(w)
Bᵗ[:, :, xᵢᵗ, 1, xᵢᵗ⁺¹] .+= Aᵗ .* w
end
end
end
end
Expand Down

0 comments on commit d927a86

Please sign in to comment.