diff --git a/test/test_treetensornetworks/test_expect.jl b/test/test_treetensornetworks/test_expect.jl index c8831350..1bd17a93 100644 --- a/test/test_treetensornetworks/test_expect.jl +++ b/test/test_treetensornetworks/test_expect.jl @@ -10,23 +10,23 @@ using Test res_a = expect("Sz", a) res_b = expect(b, "Sz") res_a = [res_a[v] for v in vertices(a)] - @test res_a ≈ res_b rtol=1e-6 + @test res_a ≈ res_b rtol = 1e-6 end @testset "TTN expect" begin - tooth_lengths = fill(5, 6) - c = named_comb_tree(tooth_lengths) - s = siteinds("S=1/2", c) - d = Dict() - magnetization = Dict() - for (i, v) in enumerate(vertices(s)) - d[v] = isodd(i) ? "Up" : "Dn" - magnetization[v] = isodd(i) ? 0.5 : -0.5 - end - states = v -> d[v] - state = TTN(s, states) - res=expect("Sz", state) # just testing that this doesn't go via expect for arbitrary tensor networks. - @test all([isapprox(res[v], magnetization[v],atol=1e-8) for v in vertices(s)]) + tooth_lengths = fill(5, 6) + c = named_comb_tree(tooth_lengths) + s = siteinds("S=1/2", c) + d = Dict() + magnetization = Dict() + for (i, v) in enumerate(vertices(s)) + d[v] = isodd(i) ? "Up" : "Dn" + magnetization[v] = isodd(i) ? 0.5 : -0.5 + end + states = v -> d[v] + state = TTN(s, states) + res = expect("Sz", state) # just testing that this doesn't go via expect for arbitrary tensor networks. + @test all([isapprox(res[v], magnetization[v]; atol=1e-8) for v in vertices(s)]) end nothing