Advanced Computing Platform for Theoretical Physics

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

use tol instead of fixed truncation; smaller initial B

parent f72f31be
Pipeline #934 failed with stages
import numpy as np
import torch
def expm(A, q=10):
def expm(A, tol=1E-12):
eA = torch.eye(A.shape[0], dtype=A.dtype, device=A.device)
trm = torch.eye(A.shape[0], dtype=A.dtype, device=A.device)
for k in range(1, q):
k = 1
while (torch.norm(trm)>tol):
trm = trm@A / k
eA += trm
k += 1
return eA
class Ising(torch.nn.Module):
......@@ -19,8 +21,7 @@ class Ising(torch.nn.Module):
self.dtype = dtype
self.device = device
B = torch.randn(niter, self.chi**2, self.chi**2, dtype=dtype, device=device)
B = B/B.norm()
B = 0.01*torch.randn(niter, self.chi**2, self.chi**2, dtype=dtype, device=device)
self.A = torch.nn.Parameter(B)
def isometry(self, step):
......
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