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

Rewrite local expectation values as a single contraction #46

Merged
merged 4 commits into from
Jun 20, 2024

Conversation

leburgel
Copy link
Collaborator

Rewrites the local expectation values as a single contraction and switches on the optimal contraction ordering in @tensor. This should improve performance, since I'm a bit skeptical the approach of first contracting the full environment and then multiplying in the operator afterward is the most efficient. This currently bypasses the operator_env function entirely, although I left it in just in case it is still needed elsewhere.

In particular, this should fix the OnSite expectation value, which was wrong before I think (it seems it assumed a transposed environment?). Also, I chose to transpose the NearestNeighbor environment density matrix to be consistent with the usual interpretation.

Copy link

codecov bot commented Jun 19, 2024

Codecov Report

Attention: Patch coverage is 33.33333% with 8 lines in your changes missing coverage. Please review.

Files Coverage Δ
src/operators/localoperator.jl 39.13% <33.33%> (-20.87%) ⬇️

@lkdvos
Copy link
Member

lkdvos commented Jun 19, 2024

Nice! I'll try and add some more tests to cover the onsite case later today, so let's wait just a second before merging

lkdvos
lkdvos previously approved these changes Jun 19, 2024
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.

Looks like a good addition to me. I added the "optimal" contraction order, by taking an order which seems to be optimal at reasonable values of the physical, bond, and boundary dimensions, but there are a couple TensorOperations fixes that need to happen before I can properly make this automatically compute an optimal order.

In general, good to go for me, I know the onsite terms are not tested, but I would make this part of the operator rewrite anyways

src/operators/localoperator.jl Outdated Show resolved Hide resolved
@leburgel leburgel merged commit 996893a into master Jun 20, 2024
11 of 12 checks passed
@leburgel leburgel deleted the lb/expvals branch June 20, 2024 08:56
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.

2 participants