I was wondering, is there some built-in functionality to apply an MPO to an MPS?

In the meantime I tried to come up with something but I am afraid it messes with the form and normalization of the MPS.

In a very simple scenario of an MPO with virtual bond dimension [1, 2, 2, ..., 1] and and no conserved charges would something like

Code: Select all

```
def contract_at_site(i, mpo, mps):
w, b = mpo.get_W(i), mps.get_B(i, form='B')
cntr = npc.tensordot(w, b, axes=('p*', 'p'))
cntr = cntr.combine_legs([['vL', 'wL'], ['vR', 'wR']], qconj=[1, -1])
cntr.ireplace_labels(['(vL.wL)', '(vR.wR)'], ['vL', 'vR'])
mps.set_B(i, cntr, form='B')
if i > 0:
s = mps.get_SL(i)
mps.set_SL(i, np.tile(s, 2))
for i in range(mps.L):
contract_at_site(i, mpo, mps)
```

(I am not interested in performance, I am mostly trying to learn about tensor networks for the moment.)

Best regards,

Marco