This repository was archived by the owner on Nov 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 364
This repository was archived by the owner on Nov 7, 2024. It is now read-only.
numpy.linalg.LinAlgError: SVD did not converge #896
Copy link
Copy link
Closed
Description
Thx for the current repo.
I want to use TensorNetwork
package to simulate time evolution of transverse ising model with itebd algorithm.
but it seems svd throws out error like this, can anyone give answers or any hints?
- does the
split_node_full_svd
used inapply_two_site_gate()
has parameter likemax_iter
or something else? - are there demo code snippets for using
tn.InfiniteMPS
ortn.FiniteMPS
with tebd algorithm?
thanks~
$ python evolution.py
1727.9739590611944
6.306919862739928e-15
0.014427307657060863
7.142939906200455e-15
0.0015813901699260678
7.156663235322543e-15
../anaconda3/envs/tf2/lib/python3.7/site-packages/tensornetwork/backends/numpy/numpy_backend.py:90: RuntimeWarning: invalid value encountered in sqrt
return np.sqrt(tensor)
Intel MKL ERROR: Parameter 4 was incorrect on entry to DLASCL.
Intel MKL ERROR: Parameter 4 was incorrect on entry to DLASCL.
Traceback (most recent call last):
File "evolution.py", line 83, in <module>
itebd_ising(N=10)
File "evolution.py", line 76, in itebd_ising
imps_state.canonicalize()
File "../anaconda3/envs/tf2/lib/python3.7/site-packages/tensornetwork/matrixproductstates/infinite_mps.py", line 276, in canonicalize
relative=True)
File "..anaconda3/envs/tf2/lib/python3.7/site-packages/tensornetwork/backends/numpy/numpy_backend.py", line 627, in svd
relative=relative)
File "../anaconda3/envs/tf2/lib/python3.7/site-packages/tensornetwork/backends/numpy/decompositions.py", line 36, in svd
u, s, vh = np.linalg.svd(tensor, full_matrices=False)
File "<__array_function__ internals>", line 6, in svd
File "../anaconda3/envs/tf2/lib/python3.7/site-packages/numpy/linalg/linalg.py", line 1636, in svd
u, s, vh = gufunc(a, signature=signature, extobj=extobj)
File "../anaconda3/envs/tf2/lib/python3.7/site-packages/numpy/linalg/linalg.py", line 106, in _raise_linalgerror_svd_nonconvergence
raise LinAlgError("SVD did not converge")
numpy.linalg.LinAlgError: SVD did not converge
code script shown below,
import tensornetwork as tn
import numpy as np
import tensorflow as tf
# tn.set_default_backend('numpy')
def itebd_ising(N=1000):
J=1.0;
g=0.5;
chi=50
d=2;
delta=0.05;
# N=3000;
# two-site Hamiltonian
H = np.array([[J, -g/2, -g/2,0],
[-g/2, -J,0,-g/2],
[-g/2.,0,-J,-g/2.],
[0,-g/2.,-g/2.,J]])
w,v=np.linalg.eig(H)
U=np.reshape(np.dot(np.dot(v,np.diag(np.exp(-delta*w))),np.transpose(v)),(2,2,2,2))
imps_state=tn.InfiniteMPS.random(d=[2,2], D=[chi,chi,chi], dtype=np.complex128)
print(imps_state.check_canonical())
imps_state.canonicalize()
print(imps_state.check_canonical())
truncation=[]
for step in range(N):
if step%2==0:
truncation_err = imps_state.apply_two_site_gate(U, site1=0, site2=1,max_singular_values=chi)
else:
truncation_err = imps_state.apply_two_site_gate(np.transpose(U,(1,0,3,2)), site1=0, site2=1,max_singular_values=chi)
truncation.append(np.linalg.norm(truncation_err))
imps_state.canonicalize()
print(np.linalg.norm(truncation_err))
print(imps_state.check_canonical())
# pdb.set_trace()
print("-"*20)
print(sum(truncation))
if __name__ == "__main__":
itebd_ising(N=10)
Metadata
Metadata
Assignees
Labels
No labels