Skip to content

Commit

Permalink
Small optimization and improved readability
Browse files Browse the repository at this point in the history
  • Loading branch information
mtfishman authored May 14, 2024
1 parent 003475a commit 0a96fd3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/caches/beliefpropagationcache.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ default_message_norm(m::ITensor) = norm(m)
function default_message_update(contract_list::Vector{ITensor}; kwargs...)
sequence = optimal_contraction_sequence(contract_list)
updated_messages = contract(contract_list; sequence, kwargs...)
n = norm(updated_messages)
if !iszero(n)
updated_messages /= norm(updated_messages)
message_norm = norm(updated_messages)
if !iszero(message_norm)
updated_messages /= message_norm
end
return ITensor[updated_messages]
end
Expand Down

0 comments on commit 0a96fd3

Please sign in to comment.