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

LazySum: Functionality to perform TDVP and find_groundstate with a lazy sum #91

Merged
merged 30 commits into from
Dec 1, 2023

Conversation

DaanMaertens
Copy link
Collaborator

Adds a new struct LazySum for a lazy sum of operators, together with a MultipleEnvironments cache for the corresponding environments. This lazy sum only gets evaluated when it is needed e.g. in expectation_value
or when the action of derivative operator is calculated. Thanks to support for the latter LazySum works out of the box for VUMPS, GradientGrassmann or TDVP algorithms. For iDMRG some minor changes were needed in order to make it work with the iDMRG environments.

@DaanMaertens
Copy link
Collaborator Author

DaanMaertens commented Nov 29, 2023

With the addition of time dependent operators in mind for the future, some support to differentiate between time dependent and time-independent operators with Holy traits, is already added. I'm not sure my implementation is satisfactory and if this system should be extended to derivative operators or left as is.

@DaanMaertens DaanMaertens requested a review from lkdvos November 29, 2023 14:11
@DaanMaertens DaanMaertens added the enhancement New feature or request label Nov 29, 2023
Copy link
Member

@lkdvos lkdvos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great PR, looks clean! Can we resolve the minor comments and then merge?

src/algorithms/groundstate/idmrg.jl Outdated Show resolved Hide resolved
src/environments/multipleenv.jl Outdated Show resolved Hide resolved
src/operators/lazysum.jl Outdated Show resolved Hide resolved
src/operators/lazysum.jl Outdated Show resolved Hide resolved
src/operators/lazysum.jl Outdated Show resolved Hide resolved
src/utility/lazysum.jl Outdated Show resolved Hide resolved
src/operators/lazysum.jl Outdated Show resolved Hide resolved
src/MPSKit.jl Outdated Show resolved Hide resolved
Co-authored-by: DaanMaertens <[email protected]>
Copy link

codecov bot commented Nov 30, 2023

Codecov Report

Attention: 31 lines in your changes are missing coverage. Please review.

Comparison is base (deb1e76) 84.72% compared to head (6bd80b4) 83.79%.
Report is 6 commits behind head on master.

Files Patch % Lines
src/operators/lazysum.jl 33.33% 18 Missing ⚠️
src/algorithms/expval.jl 77.50% 9 Missing ⚠️
src/environments/multipleenv.jl 84.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #91      +/-   ##
==========================================
- Coverage   84.72%   83.79%   -0.93%     
==========================================
  Files          61       63       +2     
  Lines        3784     3827      +43     
==========================================
+ Hits         3206     3207       +1     
- Misses        578      620      +42     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

src/algorithms/expval.jl Outdated Show resolved Hide resolved
src/algorithms/expval.jl Outdated Show resolved Hide resolved
lkdvos and others added 2 commits November 30, 2023 14:29
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
src/algorithms/expval.jl Outdated Show resolved Hide resolved
src/algorithms/groundstate/idmrg.jl Outdated Show resolved Hide resolved
src/algorithms/groundstate/idmrg.jl Outdated Show resolved Hide resolved
src/algorithms/groundstate/idmrg.jl Outdated Show resolved Hide resolved
src/algorithms/groundstate/idmrg.jl Outdated Show resolved Hide resolved
src/environments/idmrgenv.jl Outdated Show resolved Hide resolved
src/environments/idmrgenv.jl Outdated Show resolved Hide resolved
DaanMaertens and others added 3 commits November 30, 2023 14:57
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
src/algorithms/toolbox.jl Outdated Show resolved Hide resolved
src/operators/lazysum.jl Outdated Show resolved Hide resolved
test/operators.jl Outdated Show resolved Hide resolved
DaanMaertens and others added 3 commits November 30, 2023 17:50
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Comment on lines 194 to 195
envs isa MultipleEnvironments &&
throw(ArgumentError("The environment cannot be Lazy i.e. use environments of sum(H)"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
envs isa MultipleEnvironments &&
throw(ArgumentError("The environment cannot be Lazy i.e. use environments of sum(H)"))
envs isa MultipleEnvironments && throw(
ArgumentError("The environment cannot be Lazy i.e. use environments of sum(H)")
)

src/operators/lazysum.jl Outdated Show resolved Hide resolved
src/algorithms/toolbox.jl Outdated Show resolved Hide resolved
@lkdvos lkdvos merged commit 11a93d7 into master Dec 1, 2023
7 of 12 checks passed
@lkdvos lkdvos mentioned this pull request Dec 21, 2023
@lkdvos lkdvos deleted the LazySum branch August 13, 2024 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants