-
Notifications
You must be signed in to change notification settings - Fork 16
Impurity TRG #111
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
Impurity TRG #111
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
42eb330
Added the epic Impurity TRG
JaridPiceu 2ad7be1
Added export for the epic Impurity TRG
JaridPiceu 6806def
Add section impurity TRG in finalize
JaridPiceu 5d5d548
Add tests for impurty trg
JaridPiceu b731a75
Formatted all the changes
JaridPiceu fd27967
Correct tests
JaridPiceu edd8abb
Correct tests part 2
JaridPiceu c393776
Minor correction test
JaridPiceu ac00aba
Add references
JaridPiceu 7bbccd3
Removed blank spaces
JaridPiceu c50952a
Removed unclear explanation
JaridPiceu aa3f3dd
Formatted
JaridPiceu 8755762
Add citations to docs
JaridPiceu 18d0783
Removed blank space
JaridPiceu a15a759
Fixed title in bib docs
JaridPiceu 16fa21e
Fixed title in bib docs part 2?
JaridPiceu 5ff28e3
Update src/schemes/impuritytrg.jl
JaridPiceu bc83725
Update src/TNRKit.jl
JaridPiceu 8fec8fe
Update src/TNRKit.jl
JaridPiceu 7346c1a
Apply suggestion from @VictorVanthilt
JaridPiceu c9ee152
Apply suggestion from @VictorVanthilt
JaridPiceu 65caf80
Add two symmetry broken tests
JaridPiceu 20abdeb
Merge branch 'ImpurityTRG' of https://github.com/TheRealHermanator/TN…
JaridPiceu 523ddd5
Improved the tests
JaridPiceu d26a9ec
I want to grill myself because the formatting
JaridPiceu 1a54f65
Fixed small mistake
JaridPiceu b809657
Fixed bug in test
JaridPiceu 84c3a0f
Pumping up the tolerance errors
JaridPiceu 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
Some comments aren't visible on the classic Files Changed page.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| """ | ||
| $(TYPEDEF) | ||
|
|
||
| Impurity method for Tensor Renormalization Group | ||
|
|
||
| ### Constructors | ||
| $(FUNCTIONNAME)(T, T_imp1, T_imp2, T_imp3, T_imp4 [, finalize=finalize!]) | ||
|
|
||
| ### Running the algorithm | ||
| run!(::ImpurityTRG, trunc::TensorKit.TruncationSheme, stop::Stopcrit[, finalize_beginning=true, verbosity=1]) | ||
|
|
||
| Each step rescales the lattice by a (linear) factor of 2 | ||
|
|
||
| !!! info "verbosity levels" | ||
| - 0: No output | ||
| - 1: Print information at start and end of the algorithm | ||
| - 2: Print information at each step | ||
|
|
||
| ### Fields | ||
|
|
||
| $(TYPEDFIELDS) | ||
|
|
||
| ### References | ||
| * [Morita et. al. 10.48550/arXiv.2411.13998 (2024)](@cite moritaMultiimpurityMethodBondweighted2024) | ||
| * [Nakamoto et. al. 10.1007/JHEP05(2019)184 (2019)](@cite kadohTensorNetworkAnalysis2019) | ||
| """ | ||
| mutable struct ImpurityTRG <: TNRScheme | ||
| T::TensorMap | ||
| T_imp1::TensorMap | ||
| T_imp2::TensorMap | ||
| T_imp3::TensorMap | ||
| T_imp4::TensorMap | ||
|
|
||
| finalize!::Function | ||
| function ImpurityTRG( | ||
| T::TensorMap{E, S, 2, 2}, T_imp1::TensorMap{E, S, 2, 2}, T_imp2::TensorMap{E, S, 2, 2}, | ||
| T_imp3::TensorMap{E, S, 2, 2}, T_imp4::TensorMap{E, S, 2, 2}; finalize = (finalize!) | ||
| ) where {E, S} | ||
|
|
||
|
|
||
| @assert space(T, 1) == space(T_imp1, 1) == space(T_imp2, 1) == space(T_imp3, 1) == space(T_imp4, 1) "First space of T, T_imp1, T_imp2, T_imp3 and T_imp4 must be the same" | ||
| @assert space(T, 2) == space(T_imp1, 2) == space(T_imp2, 2) == space(T_imp3, 2) == space(T_imp4, 2) "Second space of T, T_imp1, T_imp2, T_imp3 and T_imp4 must be the same" | ||
| @assert space(T, 3) == space(T_imp1, 3) == space(T_imp2, 3) == space(T_imp3, 3) == space(T_imp4, 3) "Third space of T, T_imp1, T_imp2, T_imp3 and T_imp4 must be the same" | ||
| @assert space(T, 4) == space(T_imp1, 4) == space(T_imp2, 4) == space(T_imp3, 4) == space(T_imp4, 4) "Fourth space of T, T_imp1, T_imp2, T_imp3 and T_imp4 must be the same" | ||
|
|
||
| return new(T, T_imp1, T_imp2, T_imp3, T_imp4, finalize) | ||
| end | ||
| end | ||
|
|
||
| function step!(scheme::ImpurityTRG, trunc::TensorKit.TruncationScheme) | ||
| # Tensor1 | ||
| A1, B1 = SVD12(scheme.T_imp1, trunc) | ||
|
|
||
| # Tensor2 | ||
| tensor2p = transpose(scheme.T_imp2, ((2, 4), (1, 3))) | ||
| C2, D2 = SVD12(tensor2p, trunc) | ||
|
|
||
| # Tensor3 | ||
| A3, B3 = SVD12(scheme.T_imp3, trunc) | ||
|
|
||
| # Tensor4 | ||
| tensor4p = transpose(scheme.T_imp4, ((2, 4), (1, 3))) | ||
| C4, D4 = SVD12(tensor4p, trunc) | ||
|
|
||
| # Tensor pure | ||
| Ap, Bp = SVD12(scheme.T, trunc) | ||
| tensorpurep = transpose(scheme.T, ((2, 4), (1, 3))) | ||
| Cp, Dp = SVD12(tensorpurep, trunc) | ||
|
|
||
| # Contract | ||
| @planar scheme.T[-1, -2; -3, -4] := Dp[-2; 1 2] * Bp[-1; 4 1] * Cp[4 3; -3] * Ap[3 2; -4] | ||
| @planar scheme.T_imp1[-1, -2; -3, -4] := Dp[-2; 1 2] * B1[-1; 4 1] * C2[4 3; -3] * Ap[3 2; -4] | ||
| @planar scheme.T_imp2[-1, -2; -3, -4] := D2[-2; 1 2] * B3[-1; 4 1] * Cp[4 3; -3] * Ap[3 2; -4] | ||
| @planar scheme.T_imp3[-1, -2; -3, -4] := D4[-2; 1 2] * Bp[-1; 4 1] * Cp[4 3; -3] * A3[3 2; -4] | ||
| @planar scheme.T_imp4[-1, -2; -3, -4] := Dp[-2; 1 2] * Bp[-1; 4 1] * C4[4 3; -3] * A1[3 2; -4] | ||
|
|
||
| return scheme | ||
| end | ||
|
|
||
| function Base.show(io::IO, scheme::ImpurityTRG) | ||
| println(io, "ImpurityTRG - Impurity TRG") | ||
| println(io, " * T: $(summary(scheme.T))") | ||
| println(io, " * T_imp1: $(summary(scheme.T_imp1))") | ||
| println(io, " * T_imp2: $(summary(scheme.T_imp2))") | ||
| println(io, " * T_imp3: $(summary(scheme.T_imp3))") | ||
| println(io, " * T_imp4: $(summary(scheme.T_imp4))") | ||
| return nothing | ||
| 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
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
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.