is there a way to use

Code: Select all

`MPS.add(other,alpha,beta)`

I guess a brute force workaround would be to obtain the full matrices via get_B() (with all unnecessary 0s) and then create a new "empty" state and set_B(). Is there a direct way?

I actually have no idea how superpositions of MPS are constructed in the first place. Can somebody give a hand-waving explanation or refer me to the literature? I didnt get it directly from the source code of MPS.add().

Best regards,

Korbinian

edit:

For anyone else looking for a workaround in the meantime, this should work:

This is for a Bosonic chain, psis is a list [psi0, psi1] of two MPS with different total charge.

There is probably an easier way without constructing a model just to get its site structure.

Code: Select all

```
model_params = dict(
conserve = None)
M = BoseHubbardChain(model_params) # depending on what model you want put respective parameters, just important to put the following,
for j,psi in enumerate(psis):
Bs = [psi.get_B(i=i).transpose(['p', 'vL', 'vR']).to_ndarray() for i in range(psi.L)]
psi_t = MPS.from_Bflat(M.lat.mps_sites(), Bs) # expects shape (physical, vL, vR), hence the transpose in the previous line
psi_t.canonical_form() # re-calculate bonds
psis[j] = psi_t
```

Code: Select all

`psis[0].add(other = psis[1], alpha=1, beta=1)`

transpose using labels before converting to numpy array