ITensors.jl icon indicating copy to clipboard operation
ITensors.jl copied to clipboard

[ITensors] [BUG] `randomMPS` doesn't return MPS with minimal bond dimension on the boundaries

Open markusschmitt opened this issue 3 years ago • 2 comments

Description of bug Rather likely "unintended behavior" than "bug": The randomCircuitMPS function returns MPS, where the bond dimension grows starting from the end of the chain and is maximal at the first site. Usually, one would like to have the bond dimension at both the first and the last site equal to the local Hilbert space dimension and maximal at the center.

How to reproduce

using ITensors
L=8
chi=128
mps=ITensors.randomCircuitMPS(ComplexF64,sites,chi)

println(inds(mps[1]))
println(inds(mps[2]))
println(inds(mps[3]))
println()
println(inds(mps[L]))

Expected behavior Usually, one would like to have the bond dimension at both the first and the last site equal to the local Hilbert space dimension and maximal at the center. This means the expected behavior would be

((dim=2|id=204|"S=1/2,Site,n=1"), (dim=2|id=995|"Link,l=1"))
((dim=2|id=995|"Link,l=1"), (dim=2|id=514|"S=1/2,Site,n=2"), (dim=4|id=840|"Link,l=2"))
((dim=4|id=840|"Link,l=2"), (dim=2|id=378|"S=1/2,Site,n=3"), (dim=8|id=471|"Link,l=3"))

((dim=2|id=800|"Link,l=7"), (dim=2|id=610|"S=1/2,Site,n=8"))

Actual behavior The actual behavior is as described above:

((dim=2|id=715|"S=1/2,Site,n=1"), (dim=128|id=614|"Link,l=1"))
((dim=128|id=614|"Link,l=1"), (dim=2|id=616|"S=1/2,Site,n=2"), (dim=64|id=572|"Link,l=2"))
((dim=64|id=572|"Link,l=2"), (dim=2|id=446|"S=1/2,Site,n=3"), (dim=32|id=124|"Link,l=3"))

((dim=2|id=667|"Link,l=7"), (dim=2|id=541|"S=1/2,Site,n=8"))

Code demonstrating bug See above.

Version information ITensors v0.2.16

markusschmitt avatar Mar 17 '22 12:03 markusschmitt

The reason for this is because essentially this is implemented using a staircase circuit structure, which causes the asymmetry in the bond dimension.

You should be able to use the truncate!(::MPS) function if you want the minimal bond dimension at each site.

In principle we could have two staircase circuits that start from the left and right edges and meet in the middle. In that way the "center" where it meets could be a keyword argument the user could choose.

mtfishman avatar Mar 17 '22 13:03 mtfishman

Great, looks like you found a simple fix using the current code in #870.

mtfishman avatar Mar 17 '22 13:03 mtfishman