Conversation
Codecov ReportAttention: Patch coverage is
🚀 New features to boost your workflow:
|
|
|
|
Good for me, are we happy with the interface in that case? |
|
Current interface is already good for me 👍 though one minor improvement is to add a default case in which reduced_densitymatrix(inds, ket, env) = reduced_densitymatrix(inds, ket, ket, env) |
|
In the same spirit, I think it's time to resolve the TODO in PEPSKit.jl/src/algorithms/correlators.jl Lines 83 to 102 in 47e6675 The improvement is quite similar to what we are doing here with RDMs, although I haven't check the cost and memory usage there:
BTW, can you inform me automated tools used to such checks? Anyway we can do this in the PR that resolves #231. |
|
I'd have to think a bit more about that one though, it really does alter the contractions quite a bit unfortunately. I'm not sure what you mean by automatic tools for checks, what kind of checks do you have in mind? |
pbrehmer
left a comment
There was a problem hiding this comment.
Assuming that this PR is finished: Looks ready to go for me! Perhaps in the future (and in a different PR) we could have some example that uses the reduced_densitymatrix function to show how it can be used in action.
|
Lets merge #229 first, I'll update this one and see if I find the energy to actually test the performances a bit. |
|
As a comment, if you plan to support PEPO CTMRG and tensors with ancilla in the future, you may consider implementing it here. |
|
While I fully agree with this, unless someone feels like tackling that right now I might leave this for a future PR 😉 |
Replace the expectation value calculation for PEPS with computing
tr(H * rho).I checked the contraction costs and the leading cost is the same for both local operators, local norms and local density matrices. (In fact, the optimal contraction order for a single site local operator is exactly first computing the reduced densitymatrix and then contracting with the operator).
The main difference here is that instead of computing both the operator and the norm network, we can simply compute the density matrix once, divide it by its trace, and then evaluate the operator.
I'll try and include some benchmarks as well later, just to prove that everything is behaving as desired, but overall it seems to be between 25-40% faster to evaluate expectation values like this, and the memory usage scales accordingly as well.
Note that this also affects the gradient calculations, and even the compile times since the contraction functions are quite demanding for the compiler.
We should also try and hardcode the "easy" cases to optimize the intermediate permutations, but that might have to wait for a future PR.