-
Notifications
You must be signed in to change notification settings - Fork 10
Description
Hi Markus, the current matrix_eig method in abeliantensor.py keep the first several largest eigenvalues among all eigenvalues. For example, if we truncate a leg with bound dimension 30 to 20 for Z2 symmetric tensor, and let's say the initial shape is [15,15], the truncation could end up like [9,11]. However, sometimes, we may wish the truncation is evenly distributed among two sectors to be [10,10], so is it possible to support this "evenly truncation feature" for the eigenvalue decomposition for the abeliantensor?
I think the key is in line 1978 of the abeliantensor.py in matrix_eig method
# Figure out what bond dimension to truncate to, how this bond
# dimension is distributed over the different sectors, and what the
# truncation error is.
chi, dims, rel_err = type(self)._find_trunc_dim(
all_eigs,
eigdecomps,
minusabs_next_eigs,
dims,
chis=chis,
eps=eps,
break_degenerate=break_degenerate,
degeneracy_eps=degeneracy_eps,
trunc_err_func=trunc_err_func,
norm_sq=norm_sq,
)Current what I do is to add something like this after, just design for Z2-symmetric tensors
if evenTrunc:
# This piece of codes is only designed
# with Z2 symmetry tensor in mind
errmeg = "The matrix should have two sectors (0,0) and (1,1)."
assert len(dims) == 2, errmeg
if chiSpec % 2 == 0:
dims[(0, 0)] = int(chiSpec / 2)
dims[(1, 1)] = int(chiSpec / 2)
else:
dims[(0, 0)] = int((chiSpec + 1) / 2)
dims[(1, 1)] = int((chiSpec - 1) / 2)where evenTrunc is a boolean variable specifying whether we want to evenly truncate among sectors or not. However, I think there must be a better way to do it.
Xinliang