-
Notifications
You must be signed in to change notification settings - Fork 26
Add correlator for InfinitePEPO (mixed state) #274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
79c88ab
Refactor iPEPS correlator
Yue-Zhengyuan 0ce7637
Add mixed state (iPEPO) correlator
Yue-Zhengyuan 783f6a0
Fix fermionic twists
Yue-Zhengyuan 256500d
Merge remote-tracking branch 'upstream/master' into correlator-pepo
leburgel eb7ce4c
Merge remote-tracking branch 'upstream/master' into correlator-pepo
leburgel 2429c38
Separate correlator contractions and logic
Yue-Zhengyuan 6a19152
[WIP] Use `V * T` syntax [skip ci]
Yue-Zhengyuan f0cf27f
Move `correlator_horizontal/vertical` [skip ci]
Yue-Zhengyuan 1acded8
Reorganize `transfer_left`s used by correlators
Yue-Zhengyuan d773a22
Attempt at edge transfer matrices
leburgel 91cf6e9
Merge remote-tracking branch 'upstream/master' into correlator-pepo
Yue-Zhengyuan a25b06f
Test correlators with dual physical space
Yue-Zhengyuan 2cc3ac9
Merge remote-tracking branch 'upstream/master' into correlator-pepo
Yue-Zhengyuan 5e0046c
Remove dual physical space test for now
Yue-Zhengyuan a4468e9
Don't unnecessarily depend on MPSKit.jl internals
leburgel 965803f
Merge remote-tracking branch 'upstream/master' into correlator-pepo
Yue-Zhengyuan ef13490
Remove unneeded TODO
Yue-Zhengyuan a94747f
Add note
leburgel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| function start_correlator( | ||
| i::CartesianIndex{2}, ρ::InfinitePEPO, | ||
| O::PFTensor, env::CTMRGEnv | ||
| ) | ||
| (size(ρ, 3) == 1) || | ||
| throw(ArgumentError("The input PEPO ρ must have only one layer.")) | ||
| r, c = Tuple(i) | ||
| E_north = env.edges[NORTH, _prev(r, end), mod1(c, end)] | ||
| E_south = env.edges[SOUTH, _next(r, end), mod1(c, end)] | ||
| E_west = env.edges[WEST, mod1(r, end), _prev(c, end)] | ||
| C_northwest = env.corners[NORTHWEST, _prev(r, end), _prev(c, end)] | ||
| C_southwest = env.corners[SOUTHWEST, _next(r, end), _prev(c, end)] | ||
| t = twistdual(ρ[mod1(r, end), mod1(c, end)], 1:2) | ||
| # TODO: part of these contractions is duplicated between the two output tensors, | ||
| # so could be optimized further | ||
| @autoopt @tensor Vn[χSE De; χNE] := | ||
| E_south[χSE Ds; χSW2] * C_southwest[χSW2; χSW] * | ||
| E_west[χSW Dw; χNW] * C_northwest[χNW; χN] * | ||
| t[d d; Dn De Ds Dw] * E_north[χN Dn; χNE] | ||
| @autoopt @tensor Vo[χSE De dstring; χNE] := | ||
| E_south[χSE Ds; χSW2] * C_southwest[χSW2; χSW] * | ||
| E_west[χSW Dw; χNW] * C_northwest[χNW; χN] * | ||
| removeunit(O, 1)[d2; d1 dstring] * | ||
| t[d1 d2; Dn De Ds Dw] * E_north[χN Dn; χNE] | ||
| return Vn, Vo | ||
| end | ||
|
|
||
| function end_correlator_numerator( | ||
| j::CartesianIndex{2}, V::CTMRGEdgeTensor{T, S, 3}, | ||
| ρ::InfinitePEPO, O::PFTensor, env::CTMRGEnv | ||
| ) where {T, S} | ||
| (size(ρ, 3) == 1) || | ||
| throw(ArgumentError("The input PEPO ρ must have only one layer.")) | ||
| r, c = Tuple(j) | ||
| E_north = env.edges[NORTH, _prev(r, end), mod1(c, end)] | ||
| E_east = env.edges[EAST, mod1(r, end), _next(c, end)] | ||
| E_south = env.edges[SOUTH, _next(r, end), mod1(c, end)] | ||
| C_northeast = env.corners[NORTHEAST, _prev(r, end), _next(c, end)] | ||
| C_southeast = env.corners[SOUTHEAST, _next(r, end), _next(c, end)] | ||
| t = twistdual(ρ[mod1(r, end), mod1(c, end)], 1:2) | ||
| return @autoopt @tensor V[χSW DW dstring; χNW] * | ||
| E_south[χSSE DS; χSW] * E_east[χNEE DE; χSEE] * E_north[χNW DN; χNNE] * | ||
| C_northeast[χNNE; χNEE] * C_southeast[χSEE; χSSE] * | ||
| t[d1 d2; DN DE DS DW] * removeunit(O, 4)[dstring d2; d1] | ||
| end | ||
|
|
||
| function end_correlator_denominator( | ||
| j::CartesianIndex{2}, V::CTMRGEdgeTensor{T, S, 2}, env::CTMRGEnv | ||
| ) where {T, S} | ||
| r, c = Tuple(j) | ||
| C_northeast = env.corners[NORTHEAST, _prev(r, end), _next(c, end)] | ||
| E_east = env.edges[EAST, mod1(r, end), _next(c, end)] | ||
| C_southeast = env.corners[SOUTHEAST, _next(r, end), _next(c, end)] | ||
| return @autoopt @tensor V[χS DE; χN] * C_northeast[χN; χNE] * | ||
| E_east[χNE DE; χSE] * C_southeast[χSE; χS] | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| function start_correlator( | ||
| i::CartesianIndex{2}, | ||
| below::InfinitePEPS, | ||
| O::MPOTensor, | ||
| above::InfinitePEPS, | ||
| env::CTMRGEnv, | ||
| ) | ||
| r, c = Tuple(i) | ||
| E_north = env.edges[NORTH, _prev(r, end), mod1(c, end)] | ||
| E_south = env.edges[SOUTH, _next(r, end), mod1(c, end)] | ||
| E_west = env.edges[WEST, mod1(r, end), _prev(c, end)] | ||
| C_northwest = env.corners[NORTHWEST, _prev(r, end), _prev(c, end)] | ||
| C_southwest = env.corners[SOUTHWEST, _next(r, end), _prev(c, end)] | ||
| sandwich = (below[mod1(r, end), mod1(c, end)], above[mod1(r, end), mod1(c, end)]) | ||
|
|
||
| # TODO: part of these contractions is duplicated between the two output tensors, | ||
| # so could be optimized further | ||
| @autoopt @tensor Vn[χSE Detop Debot; χNE] := | ||
| E_south[χSE Dstop Dsbot; χSW2] * | ||
| C_southwest[χSW2; χSW] * | ||
| E_west[χSW Dwtop Dwbot; χNW] * | ||
| C_northwest[χNW; χN] * | ||
| conj(bra(sandwich)[d; Dnbot Debot Dsbot Dwbot]) * | ||
| ket(sandwich)[d; Dntop Detop Dstop Dwtop] * | ||
| E_north[χN Dntop Dnbot; χNE] | ||
|
|
||
| @autoopt @tensor Vo[χSE Detop dstring Debot; χNE] := | ||
| E_south[χSE Dstop Dsbot; χSW2] * | ||
| C_southwest[χSW2; χSW] * | ||
| E_west[χSW Dwtop Dwbot; χNW] * | ||
| C_northwest[χNW; χN] * | ||
| conj(bra(sandwich)[d1; Dnbot Debot Dsbot Dwbot]) * | ||
| removeunit(O, 1)[d1; d2 dstring] * | ||
| ket(sandwich)[d2; Dntop Detop Dstop Dwtop] * | ||
| E_north[χN Dntop Dnbot; χNE] | ||
|
|
||
| return Vn, Vo | ||
| end | ||
|
|
||
| function end_correlator_numerator( | ||
| j::CartesianIndex{2}, | ||
| V::AbstractTensorMap{T, S, 4, 1}, | ||
| above::InfinitePEPS, | ||
| O::MPOTensor, | ||
| below::InfinitePEPS, | ||
| env::CTMRGEnv, | ||
| ) where {T, S} | ||
| r, c = Tuple(j) | ||
| E_north = env.edges[NORTH, _prev(r, end), mod1(c, end)] | ||
| E_east = env.edges[EAST, mod1(r, end), _next(c, end)] | ||
| E_south = env.edges[SOUTH, _next(r, end), mod1(c, end)] | ||
| C_northeast = env.corners[NORTHEAST, _prev(r, end), _next(c, end)] | ||
| C_southeast = env.corners[SOUTHEAST, _next(r, end), _next(c, end)] | ||
| sandwich = (above[mod1(r, end), mod1(c, end)], below[mod1(r, end), mod1(c, end)]) | ||
|
|
||
| return @autoopt @tensor V[χSW DWt dstring DWb; χNW] * | ||
| E_south[χSSE DSt DSb; χSW] * | ||
| E_east[χNEE DEt DEb; χSEE] * | ||
| E_north[χNW DNt DNb; χNNE] * | ||
| C_northeast[χNNE; χNEE] * | ||
| C_southeast[χSEE; χSSE] * | ||
| conj(bra(sandwich)[db; DNb DEb DSb DWb]) * | ||
| ket(sandwich)[dt; DNt DEt DSt DWt] * | ||
| removeunit(O, 4)[dstring db; dt] | ||
| end | ||
|
|
||
| function end_correlator_denominator( | ||
| j::CartesianIndex{2}, V::AbstractTensorMap{T, S, 3, 1}, | ||
| env::CTMRGEnv | ||
| ) where {T, S} | ||
| r, c = Tuple(j) | ||
| C_northeast = env.corners[NORTHEAST, _prev(r, end), _next(c, end)] | ||
| E_east = env.edges[EAST, mod1(r, end), _next(c, end)] | ||
| C_southeast = env.corners[SOUTHEAST, _next(r, end), _next(c, end)] | ||
|
|
||
| return @autoopt @tensor V[χS DEt DEb; χN] * | ||
| C_northeast[χN; χNE] * | ||
| E_east[χNE DEt DEb; χSE] * | ||
| C_southeast[χSE; χS] | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,178 @@ | ||
| # | ||
| # Transfer function for (CTMRG) edges | ||
| # | ||
|
|
||
| edge_transfer_left(v, ::Nothing, A, B) = edge_transfer_left(v, A, B) | ||
| edge_transfer_right(v, ::Nothing, A, B) = edge_transfer_right(v, A, B) | ||
|
|
||
| """ | ||
| edge_transfer_left(v, Et, Eb) | ||
|
|
||
| Apply an edge transfer matrix to the left. | ||
|
|
||
| ``` | ||
| ┌─Et─ | ||
| -v │ | ||
| └─qƎ─ | ||
| ``` | ||
| """ | ||
| @generated function edge_transfer_left( | ||
| v::AbstractTensorMap{<:Any, S, 1, N₁}, | ||
| Etop::CTMRGEdgeTensor{<:Any, S, N₂}, | ||
| Ebot::CTMRGEdgeTensor{<:Any, S, N₂} | ||
| ) where {S, N₁, N₂} | ||
| t_out = tensorexpr(:v, -1, -(2:(N₁ + 1))) | ||
| t_top = tensorexpr(:Etop, 2:(N₂ + 1), -(N₁ + 1)) | ||
| t_bot = tensorexpr(:Ebot, (-1, (3:(N₂ + 1))...), 1) | ||
| t_in = tensorexpr(:v, 1, (-(2:N₁)..., 2)) | ||
| return macroexpand( | ||
| @__MODULE__, :(return @tensor $t_out := $t_in * $t_top * $t_bot) | ||
| ) | ||
| end | ||
|
|
||
|
|
||
| """ | ||
| edge_transfer_right(v, Et, Eb) | ||
|
|
||
| Apply an edge transfer matrix to the right. | ||
|
|
||
| ``` | ||
| ─Et─┐ | ||
| │ v- | ||
| ─qƎ─┘ | ||
| ``` | ||
| """ | ||
| @generated function edge_transfer_right( | ||
| v::AbstractTensorMap{<:Any, S, 1, N₁}, | ||
| Etop::CTMRGEdgeTensor{<:Any, S, N₂}, | ||
| Ebot::CTMRGEdgeTensor{<:Any, S, N₂} | ||
| ) where {S, N₁, N₂} | ||
| t_out = tensorexpr(:v, -1, -(2:(N₁ + 1))) | ||
| t_top = tensorexpr(:Etop, (-1, (3:(N₂ + 1))...), 1) | ||
| t_bot = tensorexpr(:Ebot, (2, (3:(N₂ + 1))...), -(N₁ + 1)) | ||
| t_in = tensorexpr(:v, 1, (-(2:N₁)..., 2)) | ||
| return macroexpand( | ||
| @__MODULE__, :(return @tensor $t_out := $t_top * $t_bot * $t_in) | ||
| ) | ||
| end | ||
|
|
||
| """ | ||
| edge_transfer_left(v, O, Et, Eb) | ||
|
|
||
| Apply an edge transfer matrix to the left. | ||
|
|
||
| ``` | ||
| ┌──Et─ | ||
| │ │ | ||
| v──O── | ||
| │ │ | ||
| └──qƎ─ | ||
| ``` | ||
| """ | ||
| function edge_transfer_left( | ||
| v::CTMRGEdgeTensor{<:Any, S, 3}, | ||
| O::PEPSSandwich, | ||
| Etop::CTMRGEdgeTensor{<:Any, S, 3}, | ||
| Ebot::CTMRGEdgeTensor{<:Any, S, 3}, | ||
| ) where {S} | ||
| @autoopt @tensor v´[χ_SE D_E_above D_E_below; χ_NE] := | ||
| v[χ_SW D_W_above D_W_below; χ_NW] * | ||
| Etop[χ_NW D_N_above D_N_below; χ_NE] * | ||
| Ebot[χ_SE D_S_above D_S_below; χ_SW] * | ||
| ket(O)[d; D_N_above D_E_above D_S_above D_W_above] * | ||
| conj(bra(O)[d; D_N_below D_E_below D_S_below D_W_below]) | ||
|
|
||
| return v´ | ||
| end | ||
| function edge_transfer_left( | ||
| v::CTMRGEdgeTensor{<:Any, S, 2}, | ||
| O::PFTensor, | ||
| Etop::CTMRGEdgeTensor{<:Any, S, 2}, | ||
| Ebot::CTMRGEdgeTensor{<:Any, S, 2}, | ||
| ) where {S} | ||
| @autoopt @tensor v´[χ_SE D_E; χ_NE] := | ||
| v[χ_SW D_W; χ_NW] * | ||
| Etop[χ_NW D_N; χ_NE] * | ||
| Ebot[χ_SE D_S; χ_SW] * | ||
| O[D_W D_S; D_N D_E] | ||
|
|
||
| return v´ | ||
| end | ||
|
|
||
| """ | ||
| transfer_right(v, Et, Eb) | ||
|
|
||
| Apply an edge transfer matrix to the right. | ||
|
|
||
| ``` | ||
| ──Et─┐ | ||
| │ │ | ||
| ──O──v | ||
| │ │ | ||
| ──qƎ─┘ | ||
| ``` | ||
| """ | ||
| function edge_transfer_right( | ||
| v::CTMRGEdgeTensor{<:Any, S, 3}, | ||
| O::PEPSSandwich, | ||
| Etop::CTMRGEdgeTensor{<:Any, S, 3}, | ||
| Ebot::CTMRGEdgeTensor{<:Any, S, 3}, | ||
| ) where {S} | ||
| @autoopt @tensor v′[χ_NW D_W_above D_W_below; χ_SW] := | ||
| v[χ_NE D_E_above D_E_below; χ_SE] * | ||
| Etop[χ_NW D_N_above D_N_below; χ_NE] * | ||
| Ebot[χ_SE D_S_below D_S_above; χ_SW] * | ||
| ket(O)[d; D_N_above D_E_above D_S_above D_W_above] * | ||
| conj(bra(O)[d; D_N_below D_E_below D_S_below D_W_below]) | ||
|
|
||
| return v′ | ||
| end | ||
| function edge_transfer_right( | ||
| v::CTMRGEdgeTensor{<:Any, S, 2}, | ||
| O::PFTensor, | ||
| Etop::CTMRGEdgeTensor{<:Any, S, 2}, | ||
| Ebot::CTMRGEdgeTensor{<:Any, S, 2}, | ||
| ) where {S} | ||
| return @autoopt @tensor v′[χ_NW D_W; χ_SW] := | ||
| v[χ_NE D_E; χ_SE] * | ||
| Etop[χ_NW D_N; χ_NE] * | ||
| Ebot[χ_SE D_S; χ_SW] * | ||
| O[D_W D_S; D_N D_E] | ||
|
|
||
| return v′ | ||
| end | ||
|
|
||
| """ | ||
| edge_transfer_left(v, O, Et, Eb) | ||
|
|
||
| Apply an edge transfer matrix to the left on an excited vector. | ||
|
|
||
| ``` | ||
| ┌──Et─ | ||
| │ │ | ||
| -v──O── | ||
| │ │ | ||
| └──qƎ─ | ||
| ``` | ||
| """ | ||
| function edge_transfer_left( | ||
| v::CTMRGEdgeTensor{<:Any, S, 4}, O::PEPSSandwich, | ||
| Etop::CTMRGEdgeTensor{<:Any, S, 3}, Ebot::CTMRGEdgeTensor{<:Any, S, 3}, | ||
| ) where {S} | ||
| return @autoopt @tensor v′[χ_SE D_E_above d_string D_E_below; χ_NE] := | ||
| v[χ_SW D_W_above d_string D_W_below; χ_NW] * | ||
| Etop[χ_NW D_N_above D_N_below; χ_NE] * | ||
| Ebot[χ_SE D_S_above D_S_below; χ_SW] * | ||
| ket(O)[d; D_N_above D_E_above D_S_above D_W_above] * | ||
| conj(bra(O)[d; D_N_below D_E_below D_S_below D_W_below]) | ||
| end | ||
| function edge_transfer_left( | ||
| v::CTMRGEdgeTensor{<:Any, S, 3}, O::PFTensor, | ||
| Etop::CTMRGEdgeTensor{<:Any, S, 2}, Ebot::CTMRGEdgeTensor{<:Any, S, 2}, | ||
| ) where {S} | ||
| return @autoopt @tensor v′[χ_SE D_E d_string; χ_NE] := | ||
| v[χ_SW D_W d_string; χ_NW] * | ||
| Etop[χ_NW D_N; χ_NE] * | ||
| Ebot[χ_SE D_S; χ_SW] * | ||
| O[D_W D_S; D_N D_E] | ||
| end | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.