Hello, I’ve been playing with the ITensornetworks package and want to implement a simple TTN such as below (example with 4 physical sites)
7
/ \
5 6
/ \ / \
1 2 3 4
| | | |
with the dangling dimensions equal to 2. I know how to do it on a tree in which every node has a extra physical leg with the function siteinds()
using ITensorNetworks: ttn
using ITensors
using Graphs: uniform_tree
using DataGraphs: vertex_data
n=4
psi=rand(2^n)
g=uniform_tree(n)
dmap = v -> 2
is = siteinds(dmap, g)
cutoff=0.001
tensor = ITensor(psi, vertex_data(is)...)
ttn(tensor, is; cutoff)
but I don’t know how to do it for the simple tree above where the physical legs are only at the bottom.
Any suggestions would be highly appreciated!
Thanks
Hi @nico ,
Unless it’s important that your network be initialized by factorizing a single initial tensor (the one you called tensor in your code above) then the simplest thing would be to create a tree tensor network on the graph you want to use by passing g to the ITensorNetworks.ttn constructor. Then you can use code like:
t[2] = ITensor(...)
to replace individual tensors with the ones you want, even having different indices from what they originally have (i.e. adding site indices on the sites you want). I think as long as the virtual indices still connect to form a tree you should be ok. (You may get an error if you create a loop.)
Please give it a try to see if that works for you.
Please also keep in mind that ITensorNetworks is in a somewhat experimental state and is not documented yet.