Add Neighborhood Tensor Update (NTU)#144
Add Neighborhood Tensor Update (NTU)#144Yue-Zhengyuan wants to merge 45 commits intoQuantumKitHub:mainfrom
Conversation
ad4945f to
37ace4c
Compare
9258396 to
ecbbee4
Compare
85d2c44 to
ecbbee4
Compare
1a231ec to
4c5f078
Compare
7c9ea13 to
f9d029a
Compare
|
I'll keep this as a draft for a while to not waste resources on CI. |
Yue-Zhengyuan
left a comment
There was a problem hiding this comment.
Some comments that may help with reviewing.
| twistdual!(ket, ax) | ||
| h === nothing && continue | ||
| axes, biperm = _permute_to_first(axes, ax) | ||
| ket = permute(h, ((1,), (2,))) * permute(ket, biperm) |
There was a problem hiding this comment.
This is slightly unfortunate that I have to permute h every time, because I decide to put the bra legs in front of the ket legs, and all legs in the codomain (which was the result of using ncon).
| a, X = if stype1 == :first | ||
| bond_tensor_first(A; trunc = qrtrunc) | ||
| else | ||
| @assert stype1 == :middle | ||
| bond_tensor_midnext(A; trunc = qrtrunc) | ||
| end | ||
| b, Y = if stype2 == :last | ||
| bond_tensor_last(B; trunc = qrtrunc) | ||
| else | ||
| @assert stype2 == :middle | ||
| bond_tensor_midprev(B; trunc = qrtrunc) | ||
| end |
There was a problem hiding this comment.
I may better explain why the middle sites need different treatment from the first/last sites when factoring out the reduced bond tensor.
Consider the 3-site gate MPO acting on PEPS. Its virtual bond dimension is
|
--- X --- --- a ---
| ↘
The dimension of the leg connecting X and a is a (which is going to be optimized with ALS) is
But if we keep the physical leg in X,
|
--- X --- --- a ---
| ↘
then after applying the gate, the leg connecting X, a has dimension a remains a, thus being less efficient.
The same argument applies to the last site, for which it is also better to transfer the physical leg to the bond tensor b to reduce the dimension of the bond environment.
However, things are different for middle sites.
╱
--- M --
╱ |
↓
--- g ---
↓
After applying the gate, the cluster bond dimension increases to
|
--- b --- --- Y ---
↘ |
The leg connecting b, Y have dimension b has size Y,
|
--- b --- --- Y ---
| ↘
then the leg connecting b, Y has a smaller dimension b also having a smaller size
There is also an important subtlety: for middle sites, the unitary tensors X or Y also contains the effect of the gate, in contrast to the first/last tensors, for which X, Y can be found prior to applying the gate. Thus, it seems that varying the bond tensors alone cannot reach the optimal truncation result except for NN gates.
Finally, a technical question on whether it is good to use symbols to distinguish the different cases.
| function bond_tensor_midnext(A::PEPSTensor; kwargs...) | ||
| X, a = left_orth!(permute(A, ((1, 2, 4, 5), (3,)); copy = true); kwargs...) | ||
| X = permute(X, ((1,), (2, 5, 3, 4))) | ||
| a = insertrightunit(a, 1) |
There was a problem hiding this comment.
For middle tensors, the physical leg is not transferred to the reduced bond tensor a. A trivial physical leg is added in order to fit the current bond_truncate code.
| showinfo = (iter == 1) || (iter % check_interval == 0) || (iter == it.nstep) | ||
| !showinfo && continue | ||
| # bond weight change | ||
| Δλ = hasproperty(info0, :wts) ? compare_weights(info.wts, info0.wts) : NaN |
There was a problem hiding this comment.
Here the bond weights are simply the bond_truncate SVD spectra. They are not the same as those produced by BP gauge fixing. For the first iteration, since the initialization does not provide information on bond weights, Δλ is set to NaN.
If we incorporate BP gauge fixing in the future, the bond truncation spectra should be replaced by the diagonalized BP messages. In this case, we can also find Δλ for the first step by gauge fixing the initial state.
| struct NTUState{S <: InfiniteState, N <: Number} | ||
| "number of performed iterations" | ||
| iter::Int | ||
| "evolved time" | ||
| t::N | ||
| "PEPS/PEPO" | ||
| psi::S | ||
| end |
There was a problem hiding this comment.
If we incorporate BP gauge fixing, NTUState should also include the BPEnv. It will also be used to construct bond environments. But for now I just leave it out.
(Finally, after being delayed for over a year)
This PR adds the Neighborhood Tensor Update (NTU, arXiv 2107.06635), which works for both iPEPS and iPEPO, and supports nearest neighbor 2-site gates and arbitrary MPO gates (in particular, the next-nearest neighbor 3-site MPO).
One caveat to be emphasized is that after applying an N-site gate (N > 2), the updated bonds are truncated sequentially without going back. In other words, it does not perform an ALS optimization of all site tensors that are updated, since producing the environment surrounding a general cluster of sites is complicated, and the following ALS optimization will be extremely costly.
When truncating a bond after applying a time evolution gate, the NTU uses some neighboring tensors as the bond environment, instead of using only a few bond weights (simple update) of the full iPEPS approximated by CTM (full update), "interpolating" between the two extremes. Currently the NN, NN+ and NNN bond environments (see description in the YASTN package) are implemented.