Skip to content
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

Refactor alternating_update to use sweep_regions #77

Merged
merged 24 commits into from
Jun 16, 2023
Merged

Refactor alternating_update to use sweep_regions #77

merged 24 commits into from
Jun 16, 2023

Conversation

emstoudenmire
Copy link
Contributor

Major Changes

  • update_sweep now accepts a keyword argument sweep_regions which is an array of
    "Frankentuples" i.e. a tuple of the form (region, (; step_kwargs...)) that
    tells it how to move through the tree and what arguments to pass to the solver
    and observer at each step

  • Made generic half_sweep function which handles tree iteration logic and
    uses a region_function callback to actually compute the regions that go
    into sweep_regions. (I originally tried to compute the TDVP "in between"
    regions from an array that didn't have them but this caused numerous problems.)

  • Simplified what the TDVPOrder type does. It is now basically a custom Val.

As a result of the above changes, the alternating_update and update_step
codes now basically have any TDVP-specific logic factored out of them, with
the one exception of handling printing in a more custom way. The custom
printing idea, based on appending printing functions to the set of
Observer functions, will be in a future PR.

@codecov-commenter
Copy link

codecov-commenter commented Mar 28, 2023

Codecov Report

Merging #77 (acf5aac) into main (741a28f) will increase coverage by 0.44%.
The diff coverage is 91.13%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

@@            Coverage Diff             @@
##             main      #77      +/-   ##
==========================================
+ Coverage   77.79%   78.23%   +0.44%     
==========================================
  Files          61       60       -1     
  Lines        3233     3262      +29     
==========================================
+ Hits         2515     2552      +37     
+ Misses        718      710       -8     
Impacted Files Coverage Δ
src/ITensorNetworks.jl 77.77% <ø> (ø)
src/treetensornetworks/solvers/linsolve.jl 60.00% <0.00%> (ø)
src/treetensornetworks/solvers/tdvp.jl 72.34% <73.68%> (-1.00%) ⬇️
src/treetensornetworks/solvers/tree_sweeping.jl 96.66% <96.42%> (+2.91%) ⬆️
...c/treetensornetworks/solvers/alternating_update.jl 81.48% <100.00%> (+0.77%) ⬆️
src/treetensornetworks/solvers/contract.jl 91.30% <100.00%> (-0.37%) ⬇️
src/treetensornetworks/solvers/dmrg.jl 100.00% <100.00%> (ø)
src/treetensornetworks/solvers/dmrg_x.jl 100.00% <100.00%> (ø)
src/treetensornetworks/solvers/update_step.jl 86.76% <100.00%> (+2.85%) ⬆️

... and 13 files with indirect coverage changes

@emstoudenmire
Copy link
Contributor Author

The changes in this PR are so large it may be better to do the review in person, when you have time. I could give you a tour of the new code. It's very different from the previous code so the diffs don't really help, though maybe you're better at reading them than I am.

@mtfishman
Copy link
Member

@emstoudenmire I think this looks good and I'm happy to merge this and then build on top of it in future PRs.

Let's start some issues with reminders of things we plan on improving, I've already forgotten from our last conversation. I've started with #90.

@emstoudenmire
Copy link
Contributor Author

Good idea to make a tracking issue. Glad you agree we can use this PR as a base. That's definitely how I envision it i.e. the tree_sweeping.jl code definitely could be improved and the design iterated, but this PR does accomplish the goal of totally isolating it into a closed, distinct subsystem. Also there is the observer-based printing idea but that is coming up in a follow-up PR based on this one.

Could you then please merge and I'll work on finalizing the observer printing PR, and might stick a few other improvements into that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants