[WIP] Environment initialization for CTMRG#264
Conversation
Codecov Report❌ Patch coverage is
🚀 New features to boost your workflow:
|
Co-authored-by: Lukas Devos <ldevos98@gmail.com>
|
I just noticed one more way to initialize the environment (I already have some code on this in my neighborhood tensor update branch), which we may call
For example, an edge tensor is constructed like this: In this way, the initialized environment directly have boundary dimension Recently I realized that having a good initialization is also important during full update. Right now, I'm using the environment from the last iteration as initialization for the next step. But sometimes even this doesn't work well. So I kind of hope that we can finish this PR soon. |
|
Would this give a different result from starting from environments that are the identity and doing a single step of ctmrg without truncating? |
|
Nice insight, they may indeed be the same thing... for fermions we may need to further ensure that the twists are correctly added. |
| @assert i in blocksectors(env.corners[dir, r, c]) | ||
| for (c, b) in blocks(env.corners[dir, r, c]) | ||
| b .= 0 | ||
| c == i && (b[1, 1] = 1) |
There was a problem hiding this comment.
We definitely need a test with fermionic iPEPS on this, in case parity-odd elements become -1 due to twists.
|
Given the fact that this PR might be useful for #321, I'll try to pick this up again now. However, considering the original purpose, the review comments, and the new use case in #321, it's not entirely clear to me where to go with this. Let me try to summarize. The original motivation for this PR was to solve #255, by making it 'easy' to initialize a CTMRG environment with a given bond dimension/virtual space by growing it from a smaller environment (with a product state being the default starting point. Basically, package up what people do all the time in a single method. The easiest way to do this would be to write a specialized However, since initializing environments is something very common, I tried to make it a bit more generic so that the same signature and initialization flavors could be reused in other places. This came out a bit awkward right away, as can be seen from the review comments. A first obvious problem is that the specification of virtual environment spaces really depends on what exactly we're doing, which gives rise to some awkward argument orderings. In addition, to actually 'grow' an environment we need to apply a few iterations of an algorithm (see Now in #321 there's an additional aspect, where we actually want to initialize a different kind of environment depending on the contraction algorithm we use. For now the C4v implementation uses the normal Trying to consider all of this feels a bit annoying, which is also why this PR got completely stalled in the first place. To get this moving, I think the first thing to decide is whether we want to solve the whole (potentially still growing) problem here, or we first just address the original issue #255. To address the original problem, I would switch to just writing an To go for a full generic initialize_environment([T,] network, contraction_algorithm, initialization_style, virtual_space_specification)for the generic case withing PEPSKit.jl alone. The question then becomes if this is compatible with other kinds of environment initializations (e.g. in MPSKit.jl), and if we still want it to be. Asking for any and all opinions from @lkdvos, @pbrehmer and @Yue-Zhengyuan, after which I'll have a go at getting this to a point where it's usable. |
|
I applied |
Co-authored-by: Yue Zhengyuan <yuezy1997@icloud.com>
|
Kind of starting over on this one, hopefully I can work toward something useful that can be merged soon. I'm giving up on trying to fit everything into a single Currently I have three initialization styles in mind that are useful:
These should solve both #136 and #255 already, without considering how to use this in optimization for now. In particular, none of these take a contraction algorithm as an input, which means we can avoid the nightmare of plumbing in all possible configurations. Any additional steps needed for initialization should then just be handled by the user. These last two initialization styles make use of a product state environment as an intermediate step, where especially for the To push this over the line, I'm planning to
|
|
Forgot about this, again. With another remarkable delay, I added an option to use I picked the name This definitely needs an example showcasing the different options. But I don't really have time to write one now, maybe it's best to just add the implementation already. The final thing I still wanted to do was to try and replace
Any thoughts, @Yue-Zhengyuan @lkdvos? |
Yue-Zhengyuan
left a comment
There was a problem hiding this comment.
Some small comments.
Do we spend the time completely rewrite BP in terms of ProductStateEnv
I'm in favor of this, since I feel that BPEnv and ProductStateEnv are (exactly?) the same thing, with the renaming BPEnv.messages to ProductStateEnv.edges.
| bipartite_id([T::Type=Float64], V::ProductSpace{S, 2}) where {S} | ||
|
|
||
| Constructs a tensor corresonding to the (permutation of) the identity operator between | ||
| two componens of a bipartite product space. |
There was a problem hiding this comment.
Typo: componens
The word "bipartite" is a bit ambiguous here. Until now it means the checkerboard lattice structure with 2 independent tensors.
Here, by "between two componens of a bipartite product space" do you mean "between two layers of a two-layer network"?
There was a problem hiding this comment.
Better to add docstrings to describe what each InitializationStyle is actually doing, especially ApplicationInitialization whose behavior is not obvious by just looking at the name.
| elt::Type{<:Number}, | ||
| n::InfiniteSquareNetwork, | ||
| alg::ApplicationInitialization, | ||
| env0::ProductStateEnv = ProductStateEnv(alg.f, elt, n) |
There was a problem hiding this comment.
It might be helpful not to restrict env0 to be a ProductStateEnv. For example, one may start from any CTMRGEnv with a small bond dimension, and do one step of CTMRG. But the current approach is also fine if you don't want too much freedom.
Attempt at some better environment initialization routines for CTMRG. Should solve #255 once it's finished and documented.
This implements an
initialize_environmentmethod which initializes aCTMRGEnvfor a given network according to a specificInitializationStyle. I specified three kinds ofInitializationStyles:RandomInitializationfor initializing a random environment,ProductStateInitializationfor initializing a (potentially embedded) product state environment, andApplicationInitializationwhich grows an initial environment from a product state according to a given truncation scheme. Names, arguments and which ones are optional for discussion, but at least this already handles the test case from #255 in a fairly straightforward way.