Hello,

I am implementing the TEBD algorithm in Vidal's gauge (G. Vidal, PRL 98 2007) in presence of conserved quantum numbers and I get some error regarding the indicesâ€™ arrows.

I report here a minimal example code that reproduces the issue:

```
auto sites = SpinHalf(N,{"ConserveQNs=",true});
auto init = InitState(sites);
for(auto n : range1(N))
{
init.set(n, n%2 == 1 ? "Up" : "Dn");
}
auto psi = MPS(init);
std::vector<ITensor> lambda(N-1);
for(int i=1; i<= N-1; i++)
{
auto u= commonIndex(psi(i),psi(i+1));
lambda.at(i-1) = ITensor(dag(u), prime(u));
lambda.at(i-1).set(dag(u)(1), prime(u)(1), 1.);
}
for(int b= 1; b<N; b++){
ITensor A = psi(b);
ITensor B = psi(b+1);
Print(lambda.at(b-1));
A = noPrime(lambda.at(b-1)*A);
auto AA = A*B;
auto u= commonInds(A,AA);
auto [U,S,V] = svd(AA,u,{"Truncation=", false});
lambda.at(b-1) = S;
psi.ref(b) = U;
psi.ref(b+1) = V;
}
```

Here, I initialize the system in a product state and define the lambda matrices in the second loop. After this procedure, the indices' arrows of the lambdas have the correct direction in and out.

Then, to avoid priming/unpriming indices in the lambdas, I perform the svd in the third loop, that should just change the indices from (i,i') to (i,j). Nevertheless, I observe that after contraction with the state at a local site psi(i) and SVD the direction of one of the arrows changes from in to out, thus making the contraction with the following site impossible. Furthermore, here the lambda acquires a fictitious bond dimension d=2 and its norm becomes larger by a factor sqrt(2). Please notice that the code does not show the actual TEBD, but just the minimal working patch that reproduces the issue.

Even though it might be possible to fix this issue, at least for what concerns the wrong arrows, by manually change the direction of the troublesome index, I feel like there must be something I am missing and an easier solution.

As this seems to involve the svd routine, I hope you could give some insightful answer to this issue.

Pietro