mhauru / abeliantensors Goto Github PK
View Code? Open in Web Editor NEWA library for Abelian symmetry preserving tensors in Python 3
License: MIT License
A library for Abelian symmetry preserving tensors in Python 3
License: MIT License
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
Dear Markus,
I try to exploit your package to do a SVD for an U1 symmetric real tensor A = USV. However, I found that U*U^T wasn't identity. Please help me to solve this issue, thanks!
My test code is attached as follows:
D = 10
T0 = np.random.rand(D,D)
T0 = (T0 + T0.T)/2.
d0 = int(D/3)
d1 = int((D-d0)/2)
dimv = [d1,d0,d1]
qimv = [-1,0,1]
dims = tuple([dimv]*2)
qims = tuple([qimv]*2)
dirs = [1,-1]
A = TensorU1.from_ndarray(T0, shape=dims, qhape=qims, dirs=dirs)
U, S, V = A.svd([0], [1])
#S, U = A.eig([0], [1])
U1 = np.transpose(U, [1,0])
print( 'U.dot(U1)= ', U.dot(U1.flip_dir(0),([1], [0])) )
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.