Skip to content

Commit

Permalink
do not compute accumulate_R when not debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
abraunst authored and stecrotti committed Oct 19, 2023
1 parent 4b04d3c commit 1a58fc8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/abstract_tensor_train.jl
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,11 @@ end
Compute the normalization ``Z=\\sum_{x^1,\\ldots,x^L} A^1(x^1)\\cdots A^L(x^L)``
"""
function normalization(A::AbstractTensorTrain; l = accumulate_L(A), r = accumulate_R(A))
function normalization(A::AbstractTensorTrain; l = accumulate_L(A))
z = tr(l[end])
@assert tr(r[begin]) z "z=$z, got $(tr(r[begin])), A=$A" # sanity check
@debug let r = accumulate_R(A)
@assert tr(r[begin]) z "z=$z, got $(tr(r[begin])), A=$A" # sanity check
end
z
end

Expand Down Expand Up @@ -300,4 +302,4 @@ function LinearAlgebra.normalize!(A::AbstractTensorTrain)
a ./= Z^(1/L)
end
c + log(Z)
end
end

0 comments on commit 1a58fc8

Please sign in to comment.