Add Neighborhood Tensor Update (NTU)#144
Conversation
ad4945f to
37ace4c
Compare
9258396 to
ecbbee4
Compare
85d2c44 to
ecbbee4
Compare
1a231ec to
4c5f078
Compare
7c9ea13 to
f9d029a
Compare
3a8c969 to
03a160f
Compare
|
@lkdvos Hope to get merged soon so I can proceed from here. |
lkdvos
left a comment
There was a problem hiding this comment.
Sorry for taking so long to get to this!
| function _svd_cut!(t::AbstractTensorMap) | ||
| t1, s, t2 = svd_trunc!(t; trunc = truncrank(1)) | ||
| return absorb_s(t1, s, t2) | ||
| end |
There was a problem hiding this comment.
Out of curiosity: do you need the weight to be distributed equally? Otherwise this might be replaced with left_orth!(t; trunc = truncrank(1)) or right_orth!(t; trunc = truncrank(1)), which I think removes some intermediate allocations.
There was a problem hiding this comment.
On a separate note, do we need this to be trivially charged for everything to work? It might reduce quite a bit of the number of legs if we can do something like:
A, B = left_orth!(t; trunc = truncspace(oneunit(spacetype(t))))
return removeunit(A, numind(A)), removeunit(B, 1)There was a problem hiding this comment.
do you need the weight to be distributed equally?
Nice observation! Actually no, since this D = 1 leg is in the end contracted, so how we distribute s is irrelevant.
do we need this to be trivially charged for everything to work?
It seems that _svd_cut is always applied to a positive map, which then (if my feeling is right) ensures that the leading singular value has trivial charge. I'll double-check this.
In YASTN they don't need to worry about it, since they only support Abelian symmetries and allow a tensor to have nonzero total charge.
There was a problem hiding this comment.
For _svd_cut! I have updated its docstring, describing a sufficient condition under which the largest singular value in the charge-neutral sector is also the largest in the entire SVD spectrum. The condition is satisfied by tensors constructed from contracting a bra-ket pair of tensors in a twist-free way, so indeed keeping the largest charge-neutral singular value works just as fine as truncrank(1).
| @assert 1 <= N <= 3 && Nh == 4 - N | ||
| open_axs = open_vaxs .+ 1 | ||
| # axes to be contracted | ||
| hair_axs = Tuple(ax for ax in 2:5 if ax ∉ open_axs) |
There was a problem hiding this comment.
We might want to inspect the type stability on this: I think you want this to be guaranteed to be a NTuple{4 - N, Int}, since we now the open_vaxs are all in 1:4. I'm not sure the compiler is smart enough to figure that out, which presumably affects the type stability of the remainder of this function.
There was a problem hiding this comment.
Introduced a helper function _hair_axes for type stability.
| 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 think symbols should be fine, the only other thing I can think of would be to create some @enum but I don't think it would matter in the end.
I think I follow the explanation, it seems reasonable that it is not possible to just get rid of the extra legs in the middle and that this doesn't buy us anything there.
1d22a6c to
e3f92d1
Compare
|
@lkdvos I think all comments in the last review are addressed. Ready for another round of review! |
(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.