-
Notifications
You must be signed in to change notification settings - Fork 31
Correlator for purified iPEPO and right-to-left contraction #399
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
Open
Yue-Zhengyuan
wants to merge
13
commits into
QuantumKitHub:main
Choose a base branch
from
Yue-Zhengyuan:pepo-cor-purified
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
1d3a573
Clean up correlators
Yue-Zhengyuan 98e9638
Refactor correlator functions for improved clarity
Yue-Zhengyuan 8eda2c7
Remove unused variable
Yue-Zhengyuan ade3d97
Revert to pre-allocation approach
Yue-Zhengyuan f34032c
Add correlator adapters to deduplicate
Yue-Zhengyuan fe7e649
Remove unused transfer right
Yue-Zhengyuan 5f220c2
Undo some changes
Yue-Zhengyuan 4d6c098
Correlator for purified iPEPO
Yue-Zhengyuan 7248dbb
Record removal of edge_transfer_right in changelog
Yue-Zhengyuan 7dbe885
Restore edge_transfer_right
Yue-Zhengyuan 743fac6
Right-to-left correlator contraction
Yue-Zhengyuan c9b8cbf
Rework type annotation for V (contracted correlator part)
Yue-Zhengyuan b87d161
Update changelog
Yue-Zhengyuan 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
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
135 changes: 135 additions & 0 deletions
135
src/algorithms/contractions/correlator/pepo_purified.jl
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,135 @@ | ||
| # -------- For left-to-right correlator contraction -------- | ||
|
|
||
| function start_correlator_left( | ||
| i::CartesianIndex{2}, | ||
| below::InfinitePEPO, | ||
| O::MPOTensor, | ||
| above::InfinitePEPO, | ||
| env::CTMRGEnv, | ||
| ) | ||
| r, c = Tuple(i) | ||
| E_north = edge(env, NORTH, r - 1, c) | ||
| E_south = edge(env, SOUTH, r + 1, c) | ||
| E_west = edge(env, WEST, r, c - 1) | ||
| C_northwest = corner(env, NORTHWEST, r - 1, c - 1) | ||
| C_southwest = corner(env, SOUTHWEST, r + 1, c - 1) | ||
| ket = twistdual(below[r, c], (1, 2)) | ||
| bra = above[r, c] | ||
|
|
||
| @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[d a; Dnbot Debot Dsbot Dwbot]) * | ||
| ket[d a; 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[d1 a; Dnbot Debot Dsbot Dwbot]) * | ||
| removeunit(O, 1)[d1; d2 dstring] * | ||
| ket[d2 a; Dntop Detop Dstop Dwtop] * | ||
| E_north[χN Dntop Dnbot; χNE] | ||
|
|
||
| return Vn, Vo | ||
| end | ||
|
|
||
| function end_correlator_right_numerator( | ||
| j::CartesianIndex{2}, | ||
| V::AbstractTensorMap{T, S, 4, 1}, | ||
| above::InfinitePEPO, | ||
| O::MPOTensor, | ||
| below::InfinitePEPO, | ||
| env::CTMRGEnv, | ||
| ) where {T, S} | ||
| r, c = Tuple(j) | ||
| E_north = edge(env, NORTH, r - 1, c) | ||
| E_east = edge(env, EAST, r, c + 1) | ||
| E_south = edge(env, SOUTH, r + 1, c) | ||
| C_northeast = corner(env, NORTHEAST, r - 1, c + 1) | ||
| C_southeast = corner(env, SOUTHEAST, r + 1, c + 1) | ||
| ket = twistdual(above[r, c], (1, 2)) | ||
| bra = below[r, c] | ||
|
|
||
| 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[db a; DNb DEb DSb DWb]) * | ||
| ket[dt a; DNt DEt DSt DWt] * | ||
| removeunit(O, 4)[dstring db; dt] | ||
| end | ||
|
|
||
| # -------- For right-to-left correlator contraction -------- | ||
|
|
||
| function start_correlator_right( | ||
| i::CartesianIndex{2}, | ||
| below::InfinitePEPO, | ||
| O::MPOTensor, | ||
| above::InfinitePEPO, | ||
| env::CTMRGEnv, | ||
| ) | ||
| r, c = Tuple(i) | ||
| E_north = edge(env, NORTH, r - 1, c) | ||
| E_east = edge(env, EAST, r, c + 1) | ||
| E_south = edge(env, SOUTH, r + 1, c) | ||
| C_northeast = corner(env, NORTHEAST, r - 1, c + 1) | ||
| C_southeast = corner(env, SOUTHEAST, r + 1, c + 1) | ||
| ket = twistdual(below[r, c], (1, 2)) | ||
| bra = above[r, c] | ||
|
|
||
| @autoopt @tensor Vn[χNW DWtop DWbot; χSW] := | ||
| E_south[χSSE Dstop Dsbot; χSW] * | ||
| E_east[χNEE Detop Debot; χSEE] * | ||
| E_north[χNW Dntop Dnbot; χNNE] * | ||
| C_northeast[χNNE; χNEE] * | ||
| C_southeast[χSEE; χSSE] * | ||
| conj(bra[d a; Dnbot Debot Dsbot DWbot]) * | ||
| ket[d a; Dntop Detop Dstop DWtop] | ||
|
|
||
| @autoopt @tensor Vo[χNW DWtop dstring DWbot; χSW] := | ||
| E_south[χSSE Dstop Dsbot; χSW] * | ||
| E_east[χNEE Detop Debot; χSEE] * | ||
| E_north[χNW Dntop Dnbot; χNNE] * | ||
| C_northeast[χNNE; χNEE] * | ||
| C_southeast[χSEE; χSSE] * | ||
| conj(bra[d1 a; Dnbot Debot Dsbot DWbot]) * | ||
| removeunit(O, 1)[d1; d2 dstring] * | ||
| ket[d2 a; Dntop Detop Dstop DWtop] | ||
|
|
||
| return Vn, Vo | ||
| end | ||
|
|
||
| function end_correlator_left_numerator( | ||
| j::CartesianIndex{2}, | ||
| V::AbstractTensorMap{T, S, 4, 1}, | ||
| above::InfinitePEPO, | ||
| O::MPOTensor, | ||
| below::InfinitePEPO, | ||
| env::CTMRGEnv, | ||
| ) where {T, S} | ||
| r, c = Tuple(j) | ||
| E_north = edge(env, NORTH, r - 1, c) | ||
| E_south = edge(env, SOUTH, r + 1, c) | ||
| E_west = edge(env, WEST, r, c - 1) | ||
| C_northwest = corner(env, NORTHWEST, r - 1, c - 1) | ||
| C_southwest = corner(env, SOUTHWEST, r + 1, c - 1) | ||
| ket = twistdual(above[r, c], (1, 2)) | ||
| bra = below[r, c] | ||
|
|
||
| return @autoopt @tensor V[χNE DEt dstring DEb; χSE] * | ||
| E_south[χSE DSt DSb; χSW2] * | ||
| C_southwest[χSW2; χSW] * | ||
| E_west[χSW DWt DWb; χNW] * | ||
| C_northwest[χNW; χN] * | ||
| E_north[χN DNt DNb; χNE] * | ||
| conj(bra[db a; DNb DEb DSb DWb]) * | ||
| ket[dt a; DNt DEt DSt DWt] * | ||
| removeunit(O, 4)[dstring db; dt] | ||
| 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the
Vtensors (partially contracted correlator network) are not actually CTMRG edge tensors, I prefer just annotate their type usingAbstractTensorMap.