Skip to content

Commit d5d15e8

Browse files
committed
update gauge test
1 parent 2b227c1 commit d5d15e8

2 files changed

Lines changed: 20 additions & 17 deletions

File tree

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,11 @@
44
<!-- [![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://ArrogantGao.github.io/BPGauge.jl/dev/) -->
55
<!-- [![Build Status](https://github.com/ArrogantGao/BPGauge.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/ArrogantGao/BPGauge.jl/actions/workflows/CI.yml?query=branch%3Amain) -->
66
<!-- [![Coverage](https://codecov.io/gh/ArrogantGao/BPGauge.jl/branch/main/graph/badge.svg)](https://codecov.io/gh/ArrogantGao/BPGauge.jl) -->
7+
8+
This package provides a gauge transformation for graph tensor network states.
9+
10+
A simple example:
11+
```julia
12+
13+
14+
```

test/gauge.jl

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -66,41 +66,36 @@ end
6666
@test inner_product(tn, adjoint(tn)) 1.0
6767
end
6868

69-
@testset "guage mps" begin
69+
@testset "Vidal gauge mps" begin
7070
g = chain(100)
7171
tn = random_state(g, d_virtual = 8)
7272
normalize_state!(tn)
7373

7474
bp_state = BPState(tn)
7575
bp_path = BPPath(tn)
76-
bp!(bp_state, bp_path, tn, verbose = true, err_bound = 1e-14)
76+
bp!(bp_state, bp_path, tn, err_bound = 1e-14)
7777

7878
gauge!(tn, bp_state)
79+
@test inner_product(tn, adjoint(tn)) 1.0
7980

80-
for i in 1:nv(g) - 2
81+
for i in 2:nv(g) - 2
8182
G = tn.gauge_tensors[tn.gauge_tensors_map[(i, i + 1)]]
8283
T = tn.site_tensors[i + 1]
8384
L = ein"ij, jk, jln, kmn -> lm"(G, G, T, conj(T))
84-
@show i, maximum(abs.(L ./ L[1, 1] - I(size(L, 1))))
85+
@test maximum(abs.(L ./ L[1, 1] - I(size(L, 1)))) < 1e-6
8586
end
8687
end
8788

88-
89-
@testset "Vidal gauge" begin
90-
g = chain(100)
91-
tn = random_state(g, d_virtual = 8)
89+
@testset "graph gauge" begin
90+
g = random_regular_graph(30, 3)
91+
tn = random_state(g, d_virtual = 4)
9292
normalize_state!(tn)
93-
93+
@test inner_product(tn, adjoint(tn)) 1.0
94+
9495
bp_state = BPState(tn)
9596
bp_path = BPPath(tn)
96-
bp!(bp_state, bp_path, tn, err_bound = 1e-14)
97+
bp!(bp_state, bp_path, tn, err_bound = 1e-8)
9798

9899
gauge!(tn, bp_state)
99-
100-
for i in 2:nv(g) - 2
101-
G = tn.gauge_tensors[tn.gauge_tensors_map[(i, i + 1)]]
102-
T = tn.site_tensors[i + 1]
103-
L = ein"ij, jk, jln, kmn -> lm"(G, G, T, conj(T))
104-
@test maximum(abs.(L ./ L[1, 1] - I(size(L, 1)))) < 1e-6
105-
end
100+
@test inner_product(tn, adjoint(tn)) 1.0
106101
end

0 commit comments

Comments
 (0)