I am trying to implement the transfer matrix by myself and try it on the example of the Heisenberg model using infinite DMRG with `L=2`. (The reason why I need my own implementation is because `TransferMatrix.to_matrix()` is not implemented. Here is my simple implementation,

Code: Select all

```
def readOut(psi):
psi_arr = []
for i in range(0, psi.L):
psi_i = (psi.get_B(i, form=None)).drop_charge().to_ndarray()
psi_arr.append(psi_i)
return psi_arr
def transferMatrixEpl(psi1, psi2):
# input are two lists of numpy array
d = np.shape(psi1[0])[0]
T = np.zeros((d**2, d**2), dtype = np.complex128)
for i in range(len(psi1)):
T += np.kron(psi1[i], psi2[i].conj())
return T
def debug():
E, psi, M = example_DMRG_heisenberg_xxz_infinite(1.5)
psi.canonical_form() # this is essential!
psi_arr = readOut(psi)
psi_00 = psi_arr[0][:,0,:]
psi_01 = psi_arr[0][:,1,:]
psi_10 = psi_arr[1][:,0,:]
psi_11 = psi_arr[1][:,1,:]
psi_mtr = [psi_00 @ psi_10, psi_00 @ psi_11, psi_01 @ psi_10, psi_01 @ psi_11]
Tpsi = transferMatrixEpl(psi_mtr, psi_mtr)
return Tpsi
```

Best,

Yuhan