Skip to content

Commit 813b436

Browse files
committed
Fix tests
1 parent 5b4a8fa commit 813b436

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

src/caches/beliefpropagationcache.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ function default_update_alg(bp_cache::BeliefPropagationCache)
7878
)
7979
end
8080
function default_message_update_alg(bp_cache::BeliefPropagationCache)
81-
Algorithm("contract"; normalize=true, sequence_alg="optimal")
81+
return Algorithm("contract"; normalize=true, sequence_alg="optimal")
8282
end
8383
function set_kwargs(alg::Algorithm"contract")
8484
normalize = get(alg.kwargs, :normalize, true)

test/test_apply.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ using Test: @test, @testset
3030
ψψ = norm_sqr_network(ψ)
3131
#Simple Belief Propagation Grouping
3232
bp_cache = BeliefPropagationCache(ψψ, group(v -> v[1], vertices(ψψ)))
33-
bp_cache = update(bp_cache; maxiter=20)
33+
bp_cache = update(bp_cache; alg=Algorithm("bp"; maxiter=20))
3434
envsSBP = environment(bp_cache, [(v1, "bra"), (v1, "ket"), (v2, "bra"), (v2, "ket")])
3535
ψv = VidalITensorNetwork(ψ)
3636
#This grouping will correspond to calculating the environments exactly (each column of the grid is a partition)
3737
bp_cache = BeliefPropagationCache(ψψ, group(v -> v[1][1], vertices(ψψ)))
38-
bp_cache = update(bp_cache; maxiter=20)
38+
bp_cache = update(bp_cache; alg=Algorithm("bp"; maxiter=20))
3939
envsGBP = environment(bp_cache, [(v1, "bra"), (v1, "ket"), (v2, "bra"), (v2, "ket")])
4040
inner_alg = "exact"
4141
ngates = 5

test/test_belief_propagation.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ using Test: @test, @testset
6262
@test bpc[vket] == new_A
6363
@test bpc[vbra] == new_A_dag
6464

65-
bpc = update(bpc; maxiter=25, tol=eps(real(elt)))
65+
bpc = update(bpc; alg=Algorithm("bp"; maxiter=25, tol=eps(real(elt))))
6666
#Test messages are converged
6767
for pe in partitionedges(bpc)
6868
@test message_diff(updated_message(bpc, pe), message(bpc, pe)) < 10 * eps(real(elt))

test/test_gauging.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ using Test: @test, @testset
2828
ψ = random_tensornetwork(rng, s; link_space=χ)
2929

3030
# Move directly to vidal gauge
31-
ψ_vidal = VidalITensorNetwork(ψ; cache_update_kwargs=(; maxiter=30, verbose=true))
31+
ψ_vidal = VidalITensorNetwork(
32+
ψ; cache_update_kwargs=(; alg=Algorithm("bp"; maxiter=30, verbose=true))
33+
)
3234
@test gauge_error(ψ_vidal) < 1e-8
3335

3436
# Move to symmetric gauge
@@ -40,7 +42,7 @@ using Test: @test, @testset
4042
@test inner(ψ_symm, ψ) / sqrt(inner(ψ_symm, ψ_symm) * inner(ψ, ψ)) 1.0 atol = 1e-8
4143

4244
#Test all message tensors are approximately diagonal even when we keep running BP
43-
bp_cache = update(bp_cache; maxiter=10)
45+
bp_cache = update(bp_cache; alg=Algorithm("bp"; maxiter=10))
4446
for m_e in values(messages(bp_cache))
4547
@test diag_itensor(vector(diag(only(m_e))), inds(only(m_e))) only(m_e) atol = 1e-8
4648
end

0 commit comments

Comments
 (0)