Skip to content

Conversation

@lkdvos
Copy link
Member

@lkdvos lkdvos commented Sep 2, 2025

Follow-up for #250 and #184:

I want to write reduced density matrices for densitymatrix * densitymatrix' sandwiches, assuming that we'll obtain the CTMRG environments via fusing the InfinitePEPO into a InfinitePEPS construction.

  • Write double-layer reduced densitymatrix contraction
  • Write InfinitePEPO to fused InfinitePEPS converter
  • Add tests

@Yue-Zhengyuan if you have test cases laying around that would be wonderful

@codecov
Copy link

codecov bot commented Sep 2, 2025

Codecov Report

❌ Patch coverage is 85.52632% with 11 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/algorithms/contractions/localoperator.jl 94.00% 3 Missing ⚠️
src/networks/tensors.jl 50.00% 3 Missing ⚠️
src/operators/infinitepepo.jl 57.14% 3 Missing ⚠️
src/operators/localoperator.jl 85.71% 1 Missing ⚠️
src/states/infinitepeps.jl 50.00% 1 Missing ⚠️
Files with missing lines Coverage Δ
src/algorithms/toolbox.jl 98.30% <100.00%> (+0.01%) ⬆️
src/operators/localoperator.jl 89.09% <85.71%> (+2.68%) ⬆️
src/states/infinitepeps.jl 64.65% <50.00%> (-0.26%) ⬇️
src/algorithms/contractions/localoperator.jl 78.57% <94.00%> (+4.10%) ⬆️
src/networks/tensors.jl 73.33% <50.00%> (-1.67%) ⬇️
src/operators/infinitepepo.jl 61.85% <57.14%> (+16.30%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Yue-Zhengyuan
Copy link
Member

Yue-Zhengyuan commented Sep 3, 2025

We can test the functions using test/examples/tf_ising_finiteT.jl in #250; just replace the current "manual" measurements with expectation_value. And energy measurement can also be added. (Though fermions haven't been covered)

The densitymatrix * densitymatrix' case corresponds to the purified approach to get exp(-βH). But if we don't care about it being Hermitian, it is also useful to have the reduced density matrix constructed from a single layer of PEPO (densitymatrix itself), with a function signature like

reduced_densitymatrix(inds, ρ::InfinitePEPO, env::CTMRGEnv)

where env is for the InfinitePartitionFunction obtained from ρ by tracing out the physical legs. The cost for the latter approach is smaller because the PEPO bond dimension is D instead of D^2.

@lkdvos
Copy link
Member Author

lkdvos commented Sep 3, 2025

Yeah, I would definitely like to add both but this one was easier since it was more similar to the peps case. I’ll try generalize in a follow up PR if that’s ok?

@Yue-Zhengyuan
Copy link
Member

OK. For the tests, besides the physical example of Ising model, we can just generate a random PEPO and CTMRGEnv (no need to converge the env), and check the measurement results are the same as what we would obtain if we fuse the virtual legs and the physical legs respectively of the PEPO.

@lkdvos lkdvos force-pushed the ld-pepo-densitymatrix branch from 27734f5 to 6999fd9 Compare September 3, 2025 18:33
@lkdvos lkdvos force-pushed the ld-pepo-densitymatrix branch from 6999fd9 to f3502db Compare September 3, 2025 18:33
@lkdvos lkdvos marked this pull request as ready for review September 3, 2025 18:34
@lkdvos
Copy link
Member Author

lkdvos commented Sep 3, 2025

That's a great point about the tests, thanks a lot, this really sped up the dev time for me.
I think this is now working and ready, as discussed I'll add the single-layer algorithm in a separate PR, to avoid having a huge PR here.

Copy link
Member

@Yue-Zhengyuan Yue-Zhengyuan left a comment

Choose a reason for hiding this comment

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

Do you mind if I make the tests a bit more strict (and some other minor changes)?

@lkdvos
Copy link
Member Author

lkdvos commented Sep 4, 2025

Feel free to make the changes, and I agree with your comments

@lkdvos lkdvos force-pushed the ld-pepo-densitymatrix branch from f3502db to 167ab9b Compare September 4, 2025 11:10
Copy link
Member

@Yue-Zhengyuan Yue-Zhengyuan left a comment

Choose a reason for hiding this comment

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

OK to merge for me once the tests pass.

@lkdvos lkdvos enabled auto-merge (squash) September 4, 2025 12:52
@lkdvos lkdvos merged commit 1ac5857 into master Sep 4, 2025
51 checks passed
@lkdvos lkdvos deleted the ld-pepo-densitymatrix branch September 4, 2025 13:05
@Yue-Zhengyuan Yue-Zhengyuan mentioned this pull request Sep 17, 2025
2 tasks
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