Skip to content

Commit

Permalink
Fix expect test
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeyT1994 committed Jan 16, 2025
1 parent 0228aa1 commit 1fcf947
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions test/test_expect.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@ using Test: @test, @testset
s = siteinds("S=1/2", g)
rng = StableRNG(1234)
ψ = random_tensornetwork(rng, s; link_space=χ)
cache_construction_function =
f -> BeliefPropagationCache(
f; partitioned_vertices=group(v -> (original_state_vertex(f, v)[1]), vertices(f))
)
sz_bp = expect(ψ, "Sz"; alg="bp", cache_construction_function)
quadratic_form_vertices = reduce(
vcat, [[(v, "ket"), (v, "bra"), (v, "operator")] for v in vertices(ψ)]
)
cache_construction_kwargs = (;
partitioned_vertices=group(v -> first(first(v)), quadratic_form_vertices)
)
sz_bp = expect(ψ, "Sz"; alg="bp", cache_construction_kwargs)
sz_exact = expect(ψ, "Sz"; alg="exact")
@test sz_bp sz_exact

Expand Down

0 comments on commit 1fcf947

Please sign in to comment.