Advanced Computing Platform for Theoretical Physics

Commit 50c26bee authored by Lei Wang's avatar Lei Wang
Browse files

krylov need a good starting point, try nlsolver see if it is the same

parent 1cd0d027
...@@ -92,7 +92,7 @@ if __name__=='__main__': ...@@ -92,7 +92,7 @@ if __name__=='__main__':
import time import time
torch.manual_seed(42) torch.manual_seed(42)
d = 2 d = 2
chi = 20 chi = 40
device = 'cpu' device = 'cpu'
dtype = torch.float64 dtype = torch.float64
...@@ -104,7 +104,7 @@ if __name__=='__main__': ...@@ -104,7 +104,7 @@ if __name__=='__main__':
T[1, 0, 0, 0] = 1.0 T[1, 0, 0, 0] = 1.0
ctmrg = CTMRG.apply ctmrg = CTMRG.apply
C, E = ctmrg(T, chi, 100) C, E = ctmrg(T, chi, 1000, 1E-6)
x = torch.cat([C.view(-1), E.view(-1)]).numpy() x = torch.cat([C.view(-1), E.view(-1)]).numpy()
...@@ -116,5 +116,5 @@ if __name__=='__main__': ...@@ -116,5 +116,5 @@ if __name__=='__main__':
return torch.cat([C.view(-1), E.view(-1)]).numpy() - x return torch.cat([C.view(-1), E.view(-1)]).numpy() - x
from scipy import optimize from scipy import optimize
sol = optimize.root(fun, x, method='krylov', options={'fatol':1E-12, 'disp': True}) sol = optimize.root(fun, x, method='krylov', options={'fatol':1E-13, 'disp': True, 'jac_options':{'method': 'lgmres'} })
print (sol) print (sol)
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