Advanced Computing Platform for Theoretical Physics

Commit e8cab639 authored by Lei Wang's avatar Lei Wang
Browse files

use same ludr convention for hotrg2

parent ef1c3fcb
......@@ -6,13 +6,11 @@ adapted from Jin Chen's hotrg.jl at https://github.com/wangleiphy/TRG/blob/maste
def gauge(T, Dcut, side):
if side=='l':
M = torch.einsum('xazb,xcwb,wlyn,zmyn->amcl' , (T, T, T, T))
M = torch.einsum('axzb,cxwb,lwyn,mzyn->amcl', (T, T, T, T))
elif side=='r':
M = torch.einsum('xbza,xbwc,wlyn,zlym->amcn', (T, T, T, T))
M = torch.einsum('bxza,bxwc,lwyn,lzym->amcn', (T, T, T, T))
D = M.shape[0]
M = M.contiguous().view(D**2, D**2)
#M = ( M + M.t()) / 2.0;
#w, v = torch.symeig(M, eigenvectors=True)
U, S, V = torch.svd(M)
Dnew = min(D**2, Dcut)
......@@ -32,18 +30,18 @@ def hotrg(T, D, Dcut, no_iter):
vr, er = gauge(T, Dcut,'r')
U = vl if (el < er) else vr
truncation_error += min(el, er)
T = torch.einsum('xaob,amz,omyn,bnw->wxzy',(T, U, T, U))
T = torch.einsum('axob,amz,moyn,bnw->xwzy',(T, U, T, U))
trace = 0.0
for x in range(T.shape[0]):
for y in range(T.shape[1]):
trace += T[x, y, x, y]
trace += T[x, y, y, x]
lnZ += torch.log(trace)
return lnZ, truncation_error
if __name__=='__main__':
K = torch.tensor([0.44])
Dcut = 10
Dcut = 20
n = 20
#Boltzmann factor on a bond M=LR^T
......@@ -60,7 +58,6 @@ if __name__=='__main__':
# |
# R^{T}
# T is a D*D*D*D tensor u l d r
T = torch.einsum('ai,aj,ak,al->ijkl', (L, R, R, L))
T = torch.einsum('ai,aj,ak,al->ijkl', (R, L, R, L))
lnZ, _ = hotrg(T, 2, Dcut, n)
print (lnZ.item()/2**n)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment