|
4 | 4 | verbosity::Int = 2 |
5 | 5 | end |
6 | 6 |
|
| 7 | +function gauge_fix(psi::InfinitePEPS, alg::BeliefPropagation, env::BPEnv=BPEnv(psi)) |
| 8 | + # Compute belief propagation fixed point solutions |
| 9 | + env, err = bp_fixedpoint(env, InfiniteSquareNetwork(psi), alg) |
| 10 | + |
| 11 | + # Bring PEPS to the Vidal gauge |
| 12 | + sqrtmsgs = map(env.messages) do M |
| 13 | + U, S, Vᴴ = tsvd!(M) |
| 14 | + sqrtM = U * sdiag_pow(S, 1 / 2) * Vᴴ |
| 15 | + isqrtM = U * sdiag_pow(S, -1 / 2) * Vᴴ |
| 16 | + return sqrtM, isqrtM |
| 17 | + end |
| 18 | + bond_svds = map(eachcoordinate(psi, 1:2)) do (dir, r, c) |
| 19 | + # TODO: would be more reasonable to define SOUTH as adjoint(NORTH)... |
| 20 | + MM = sqrtmsgs[dir, r, c][1] * transpose(sqrtmsgs[mod1(dir + 2, 4), r, c][1]) |
| 21 | + U, S, Vᴴ = tsvd!(MM) |
| 22 | + return U, S, Vᴴ |
| 23 | + end |
| 24 | + vertices = map(eachcoordinate(psi)) do (r, c) |
| 25 | + isqrtM_north = sqrtmsgs[NORTH, _prev(r, end), c][2] |
| 26 | + isqrtM_south = sqrtmsgs[SOUTH, _next(r, end), c][2] |
| 27 | + isqrtM_east = sqrtmsgs[EAST, r, _next(c, end)][2] |
| 28 | + isqrtM_west = sqrtmsgs[WEST, r, _prev(c, end)][2] |
| 29 | + |
| 30 | + U_north = bond_svds[NORTH, _prev(r, end), c][1] |
| 31 | + U_east = bond_svds[EAST, r, _next(c, end)][1] |
| 32 | + Vᴴ_south = bond_svds[NORTH, _next(r, end), c][3] |
| 33 | + Vᴴ_west = bond_svds[EAST, r, _prev(c, end)][3] |
| 34 | + |
| 35 | + @tensor contractcheck = true begin |
| 36 | + A[d; DN DE DS DW] ≔ |
| 37 | + psi[r, c][d; DN1 DE1 DS1 DW1] * |
| 38 | + (isqrtM_north[DN1; DN2] * U_north[DN2; DN]) * |
| 39 | + (isqrtM_east[DE1; DE2] * U_east[DE2; DE]) * |
| 40 | + (isqrtM_south[DS1; DS2] * Vᴴ_south[DS; DS2]) * |
| 41 | + (isqrtM_west[DW1; DW2] * Vᴴ_west[DW; DW2]) |
| 42 | + end |
| 43 | + return A |
| 44 | + end |
| 45 | + # TODO: decide on a convention here, possibly altering InfiniteWeightPEPS |
| 46 | + weight_mats = SUWeight( |
| 47 | + map(eachcoordinate(psi, 1:2)) do (dir, r, c) |
| 48 | + if dir == 1 # horizontal direction |
| 49 | + return bond_svds[EAST, r, _next(c, end)][2] |
| 50 | + else # vertical direction |
| 51 | + return bond_svds[NORTH, _prev(r, end), c][2] |
| 52 | + end |
| 53 | + end, |
| 54 | + ) |
| 55 | + return InfiniteWeightPEPS(vertices, weight_mats) |
| 56 | +end |
| 57 | + |
7 | 58 | function bp_fixedpoint(env::BPEnv, network::InfiniteSquareNetwork, alg::BeliefPropagation) |
8 | 59 | log = MPSKit.IterLog("BP") |
9 | 60 | ϵ = Inf |
|
0 commit comments