Hi folks,

I am trying to copy the first 1...L÷2 matrices of an MPS to the last L÷2+1...L matrices (in order to get the symmetric copy of the MPS). the layout is as following:

```
A - B - C - U λ - V - D - E - F
| | | | | | | |
=> A - B - C - U λ - U - C - B - A
| | | | | | | |
```

The problem I am having right now is that I am not able to link Uλ with U. However, since λ is diagonal, this should be possible in principle. In particular, this works without quantum numbers, but with quantum numbers somehow the order of the blocks is reversed. Do you have an idea how I could go on in that situation? Here some code:

```
L = 8
maxdim = 20
sites = siteinds("S=1/2",L,conserve_szparity=true)
ψ = randomMPS(sites,[rand(Bool) ? "↑" : "↓" for i in 1:L]);
truncate!(ψ,maxdim=maxdim)
orthogonalize!(ψ,L÷2);
U, λ, V = svd(ψ[L÷2]*ψ[L÷2+1], uniqueinds(ψ[L÷2],ψ[L÷2+1]))
ψ_new = copy(ψ)
s_ind1 = siteindex(ψ,L)
s_ind2 = siteindex(ψ,1)
bondL = commonind(ψ[1],ψ[2])
ψ_new[L] = prime(replaceind(ψ[1],s_ind2,s_ind1),bondL)
for i in 2:L÷2-1
s_ind1 = siteindex(ψ,L-i+1)
s_ind2 = siteindex(ψ,i)
bondL = commonind(ψ[i],ψ[i+1])
bondR = commonind(ψ[i],ψ[i-1])
ψ_new[L-i+1] = replaceind(ψ[i],s_ind2,s_ind1)
prime!(ψ_new[L-i+1],bondL)
prime!(ψ_new[L-i+1],bondR)
end
ψ_new[L÷2] = U*λ
linku = commonind(U,λ)
linkv = commonind(V,λ)
bondL = commonind(ψ[L÷2],ψ[L÷2-1])
s_ind1 = siteindex(ψ,L÷2+1)
s_ind2 = siteindex(ψ,L÷2)
ψ_new[L÷2+1] = replaceind(U,s_ind2,s_ind1)
prime!(ψ_new[L÷2+1],bondL)
replaceind!(ψ_new[L÷2+1],linku,linkv)
```

The error I get in the last line here is

```
Indices must have the same spaces to be replaced
```

If we look at linku and linkv, it becomes apparent that they do not coincide (in dimensionality and quantum numbers), even though λ is diagonal. This is something I do not quite understand, does this diagonality somehow change when using quantum numbers?

Best,

v.