Hello Miles,

I am trying to time evolve a state using a Hamiltonian, which changes every time step. The Hamiltonian consists of a constant two-site term (for which I evolve using Trotter gates), and a varying single-site term, which is diagonal.

Since the sequence will be run many times, the total time of the process of exponentiating the Hamiltonian and applying it needs to be as fast as possible.

Currently I create the exponent through toExpH, and apply the tensors directly to the MPS right after the forward sweep of Trotter gates, like this:

```
if (ni1 >= i2)
{
psi.svdBond(i1,AA,Fromleft,args);
auto Ap = psi.A(i1)*expHt.A(i1);
Ap.mapprime(1,0,Site);
psi.setA(i1,Ap);
psi.position(ni1);
}
```

Although this method is fairly fast, I need it to be even faster. Is there any way I can effectively truncate the MPS after applying the expHt, or can I somehow utilize the diagonal form of the time dependent Hamiltonian Ht?

Thank you!

edited Jan 29 by Concerned citizen

Thank you very much for your response. Just to make clear:

(1) the "denmatDecomp" method requires me to create two new tensors "A" and "B" from the two-site tensor "AA" and then manually set their correct location in the MPS?

I have tried using this approach by setting

IQTensor A,B;

denmatDecomp(AA,A,B,Fromleft,args);

A.mapprime(1,0,Site);

B.mapprime(1,0,Site);

psi.setA(i1,A);

psi.setA(i2,B);

but this results in a error regarding arrows.

Should I instead modify the .svdBond() method, such that it is forced to use the denmatDecomp routine?

(2) how does one use the set method for operators. Say I want exponentiate a number operator "N" for time evolution, which of course i diagonal. Should you do

T .set(1,1,1 , exp(0) )

T .set(2,2,2 , exp(1*dt) )

T .set(3,3,3 , exp(2*dt) )

.... and so on ?