Skip to content

Commit

Permalink
Format
Browse files Browse the repository at this point in the history
  • Loading branch information
leburgel committed Jun 19, 2024
1 parent f5ee89c commit d67dee3
Showing 1 changed file with 56 additions and 54 deletions.
110 changes: 56 additions & 54 deletions src/operators/localoperator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -78,31 +78,33 @@ of `peps` and `env`.
""" MPSKit.expectation_value(::InfinitePEPS, ::Any, ::NLocalOperator)

# 1-site operator expectation values on unit cell
function MPSKit.expectation_value(peps::InfinitePEPS, env::CTMRGEnv, O::NLocalOperator{OnSite})
function MPSKit.expectation_value(

Check warning on line 81 in src/operators/localoperator.jl

View check run for this annotation

Codecov / codecov/patch

src/operators/localoperator.jl#L81

Added line #L81 was not covered by tests
peps::InfinitePEPS, env::CTMRGEnv, O::NLocalOperator{OnSite}
)
return map(Iterators.product(axes(env.corners, 2), axes(env.corners, 3))) do (r, c)
o = @tensor opt = true env.corners[NORTHWEST, r, c][1; 2] *
env.edges[NORTH, r, c][2 3 4; 5] *
env.corners[NORTHEAST, r, c][5; 6] *
env.edges[EAST, r, c][6 7 8; 9] *
env.corners[SOUTHEAST, r, c][9; 10] *
env.edges[SOUTH, r, c][10 11 12; 13] *
env.corners[SOUTHWEST, r, c][13; 14] *
env.edges[WEST, r, c][14 15 16; 1] *
peps[r, c][17; 3 7 11 15] *
conj(peps[r, c][18; 4 8 12 16]) *
O.op[18; 17]
n = @tensor opt = true env.corners[NORTHWEST, r, c][1; 2] *
env.edges[NORTH, r, c][2 3 4; 5] *
env.corners[NORTHEAST, r, c][5; 6] *
env.edges[EAST, r, c][6 7 8; 9] *
env.corners[SOUTHEAST, r, c][9; 10] *
env.edges[SOUTH, r, c][10 11 12; 13] *
env.corners[SOUTHWEST, r, c][13; 14] *
env.edges[WEST, r, c][14 15 16; 1] *
peps[r, c][17; 3 7 11 15] *
conj(peps[r, c][17; 4 8 12 16])
o = @tensor opt = true env.corners[NORTHWEST, r, c][1; 2] *

Check warning on line 85 in src/operators/localoperator.jl

View check run for this annotation

Codecov / codecov/patch

src/operators/localoperator.jl#L84-L85

Added lines #L84 - L85 were not covered by tests
env.edges[NORTH, r, c][2 3 4; 5] *
env.corners[NORTHEAST, r, c][5; 6] *
env.edges[EAST, r, c][6 7 8; 9] *
env.corners[SOUTHEAST, r, c][9; 10] *
env.edges[SOUTH, r, c][10 11 12; 13] *
env.corners[SOUTHWEST, r, c][13; 14] *
env.edges[WEST, r, c][14 15 16; 1] *
peps[r, c][17; 3 7 11 15] *
conj(peps[r, c][18; 4 8 12 16]) *
O.op[18; 17]

n = @tensor opt = true env.corners[NORTHWEST, r, c][1; 2] *

Check warning on line 97 in src/operators/localoperator.jl

View check run for this annotation

Codecov / codecov/patch

src/operators/localoperator.jl#L97

Added line #L97 was not covered by tests
env.edges[NORTH, r, c][2 3 4; 5] *
env.corners[NORTHEAST, r, c][5; 6] *
env.edges[EAST, r, c][6 7 8; 9] *
env.corners[SOUTHEAST, r, c][9; 10] *
env.edges[SOUTH, r, c][10 11 12; 13] *
env.corners[SOUTHWEST, r, c][13; 14] *
env.edges[WEST, r, c][14 15 16; 1] *
peps[r, c][17; 3 7 11 15] *
conj(peps[r, c][17; 4 8 12 16])

o / n
end
end
Expand All @@ -112,36 +114,36 @@ function MPSKit.expectation_value(
)
return map(Iterators.product(axes(env.corners, 2), axes(env.corners, 3))) do (r, c)
cnext = _next(c, size(peps, 2))
o = @tensor opt = true env.corners[NORTHWEST, r, c][1; 3] *
env.edges[NORTH, r, c][3 5 8; 13] *
env.edges[NORTH, r, cnext][13 16 22; 23] *
env.corners[NORTHEAST, r, cnext][23; 24] *
env.edges[EAST, r, cnext][24 25 26; 27] *
env.corners[SOUTHEAST, r, cnext][27; 28] *
env.edges[SOUTH, r, cnext][28 17 21; 14] *
env.edges[SOUTH, r, c][14 6 10; 4] *
env.corners[SOUTHWEST, r, c][4; 2] *
env.edges[WEST, r, c][2 7 9; 1] *
peps[r, c][29; 5 15 6 7] *
conj(peps[r, c][31; 8 19 10 9]) *
peps[r, cnext][30; 16 25 17 15] *
conj(peps[r, cnext][32; 22 26 21 19]) *
O.op[31 32; 29 30]
n = @tensor opt = true env.corners[NORTHWEST, r, c][1; 3] *
env.edges[NORTH, r, c][3 5 8; 13] *
env.edges[NORTH, r, cnext][13 16 22; 23] *
env.corners[NORTHEAST, r, cnext][23; 24] *
env.edges[EAST, r, cnext][24 25 26; 27] *
env.corners[SOUTHEAST, r, cnext][27; 28] *
env.edges[SOUTH, r, cnext][28 17 21; 14] *
env.edges[SOUTH, r, c][14 6 10; 4] *
env.corners[SOUTHWEST, r, c][4; 2] *
env.edges[WEST, r, c][2 7 9; 1] *
peps[r, c][29; 5 15 6 7] *
conj(peps[r, c][29; 8 19 10 9]) *
peps[r, cnext][30; 16 25 17 15] *
conj(peps[r, cnext][30; 22 26 21 19])
o = @tensor opt = true env.corners[NORTHWEST, r, c][1; 3] *
env.edges[NORTH, r, c][3 5 8; 13] *
env.edges[NORTH, r, cnext][13 16 22; 23] *
env.corners[NORTHEAST, r, cnext][23; 24] *
env.edges[EAST, r, cnext][24 25 26; 27] *
env.corners[SOUTHEAST, r, cnext][27; 28] *
env.edges[SOUTH, r, cnext][28 17 21; 14] *
env.edges[SOUTH, r, c][14 6 10; 4] *
env.corners[SOUTHWEST, r, c][4; 2] *
env.edges[WEST, r, c][2 7 9; 1] *
peps[r, c][29; 5 15 6 7] *
conj(peps[r, c][31; 8 19 10 9]) *
peps[r, cnext][30; 16 25 17 15] *
conj(peps[r, cnext][32; 22 26 21 19]) *
O.op[31 32; 29 30]

n = @tensor opt = true env.corners[NORTHWEST, r, c][1; 3] *
env.edges[NORTH, r, c][3 5 8; 13] *
env.edges[NORTH, r, cnext][13 16 22; 23] *
env.corners[NORTHEAST, r, cnext][23; 24] *
env.edges[EAST, r, cnext][24 25 26; 27] *
env.corners[SOUTHEAST, r, cnext][27; 28] *
env.edges[SOUTH, r, cnext][28 17 21; 14] *
env.edges[SOUTH, r, c][14 6 10; 4] *
env.corners[SOUTHWEST, r, c][4; 2] *
env.edges[WEST, r, c][2 7 9; 1] *
peps[r, c][29; 5 15 6 7] *
conj(peps[r, c][29; 8 19 10 9]) *
peps[r, cnext][30; 16 25 17 15] *
conj(peps[r, cnext][30; 22 26 21 19])
o / n
end
end
Expand Down

0 comments on commit d67dee3

Please sign in to comment.