@@ -32,15 +32,13 @@ julia> ] add ITensorNetworks
3232Here are is an example of making a tensor network on a chain graph (a tensor train or matrix product state):
3333
3434``` julia
35- julia> using Graphs: neighbors
35+ julia> using Graphs: neighbors, path_graph
3636
37- julia> using ITensorNetworks: ITensorNetwork, siteinds
37+ julia> using ITensorNetworks: ITensorNetwork
3838
39- julia> using NamedGraphs: named_grid, subgraph
40-
41- julia> tn = ITensorNetwork (named_grid (4 ); link_space= 2 )
39+ julia> tn = ITensorNetwork (path_graph (4 ); link_space= 2 )
4240ITensorNetworks. ITensorNetwork{Int64} with 4 vertices:
43- 4 - element Vector {Int64}:
41+ 4 - element Dictionaries . Indices {Int64}
4442 1
4543 2
4644 3
@@ -89,9 +87,13 @@ julia> neighbors(tn, 4)
8987and here is a similar example for making a tensor network on a grid (a tensor product state or project entangled pair state (PEPS)):
9088
9189``` julia
90+ julia> using NamedGraphs. GraphsExtensions: subgraph
91+
92+ julia> using NamedGraphs. NamedGraphGenerators: named_grid
93+
9294julia> tn = ITensorNetwork (named_grid ((2 , 2 )); link_space= 2 )
9395ITensorNetworks. ITensorNetwork{Tuple{Int64, Int64}} with 4 vertices:
94- 4 - element Vector {Tuple{Int64, Int64}}:
96+ 4 - element Dictionaries . Indices {Tuple{Int64, Int64}}
9597 (1 , 1 )
9698 (2 , 1 )
9799 (1 , 2 )
@@ -126,7 +128,7 @@ julia> neighbors(tn, (1, 2))
126128
127129julia> tn_1 = subgraph (v -> v[1 ] == 1 , tn)
128130ITensorNetworks. ITensorNetwork{Tuple{Int64, Int64}} with 2 vertices:
129- 2 - element Vector {Tuple{Int64, Int64}}:
131+ 2 - element Dictionaries . Indices {Tuple{Int64, Int64}}
130132 (1 , 1 )
131133 (1 , 2 )
132134
@@ -140,7 +142,7 @@ with vertex data:
140142
141143julia> tn_2 = subgraph (v -> v[1 ] == 2 , tn)
142144ITensorNetworks. ITensorNetwork{Tuple{Int64, Int64}} with 2 vertices:
143- 2 - element Vector {Tuple{Int64, Int64}}:
145+ 2 - element Dictionaries . Indices {Tuple{Int64, Int64}}
144146 (2 , 1 )
145147 (2 , 2 )
146148
@@ -159,13 +161,13 @@ Networks can also be merged/unioned:
159161``` julia
160162julia> using ITensors: prime
161163
162- julia> using ITensorNetworks: ⊗ , contract, contraction_sequence
164+ julia> using ITensorNetworks: ⊗ , contract, contraction_sequence, siteinds
163165
164166julia> using ITensorUnicodePlots: @visualize
165167
166168julia> s = siteinds (" S=1/2" , named_grid (3 ))
167169ITensorNetworks. IndsNetwork{Int64, ITensors. Index} with 3 vertices:
168- 3 - element Vector {Int64}:
170+ 3 - element Dictionaries . Indices {Int64}
169171 1
170172 2
171173 3
@@ -185,7 +187,7 @@ and edge data:
185187
186188julia> tn1 = ITensorNetwork (s; link_space= 2 )
187189ITensorNetworks. ITensorNetwork{Int64} with 3 vertices:
188- 3 - element Vector {Int64}:
190+ 3 - element Dictionaries . Indices {Int64}
189191 1
190192 2
191193 3
@@ -202,7 +204,7 @@ with vertex data:
202204
203205julia> tn2 = ITensorNetwork(s; link_space=2)
204206ITensorNetworks.ITensorNetwork{Int64} with 3 vertices:
205- 3-element Vector {Int64}:
207+ 3-element Dictionaries.Indices {Int64}
206208 1
207209 2
208210 3
@@ -293,8 +295,8 @@ julia> @visualize Z;
293295
294296julia> contraction_sequence (Z)
2952972 - element Vector{Vector}:
296- NamedGraphs. Key{Tuple{Int64, Int64}}[Key ((1 , 1 )), Key ((1 , 2 ))]
297- Any[Key ((2 , 1 )), Any[Key ((2 , 2 )), NamedGraphs. Key{Tuple{Int64, Int64}}[Key ((3 , 1 )), Key ((3 , 2 ))]]]
298+ NamedGraphs. Keys . Key{Tuple{Int64, Int64}}[Key ((1 , 1 )), Key ((1 , 2 ))]
299+ Any[Key ((2 , 1 )), Any[Key ((2 , 2 )), NamedGraphs. Keys . Key{Tuple{Int64, Int64}}[Key ((3 , 1 )), Key ((3 , 2 ))]]]
298300
299301julia> Z̃ = contract (Z, (1 , 1 ) => (2 , 1 ));
300302
@@ -303,20 +305,20 @@ julia> @visualize Z̃;
303305 ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
304306 ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
305307 ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
306- ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀Z̃ ( 2 , 1 ) ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
307- ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ( 2 ) ' ⠤⠤⠔⠒⠒⠉⠉⠀⠀⢱⠀⠈⠉⠑⠒⠢⠤⢄⣀2 ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
308- ⠀⠀⠀⠀⠀⠀⠀⣀⣀⠤⠤⠔⠒⠊⠉⠉ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⡆ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠉ ⠒⠒⠤⠤⢄⣀⡀ ⠀⠀⠀⠀⠀
309- ⠀Z̃ ( 3 , 1 ) ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢱ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀Z̃ (1 , 2 )⠀⠀
310- ⠀⠀⠀⠀⠀⢸ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⡆ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠔⠁ ⠀⠀⠀⠀⠀⠀⠀
311- ⠀⠀⠀⠀⠀⠀⡇⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀2 ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⠔ ⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀
312- ⠀⠀⠀⠀⠀⠀⢸ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇ ⠀⠀⠀⠀⠀⠀⠀⡠2 ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
313- ⠀⠀⠀⠀⠀⠀⠀⡇ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⡠⠊ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
314- ⠀⠀⠀⠀⠀⠀⠀2⡀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⢀⠤⠊ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
315- ⠀⠀⠀⠀⠀⠀⠀⠀⢇ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ Z̃ (2 , 2 )⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
316- ⠀⠀⠀⠀⠀⠀⠀⠀⠸⡀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⡠⠤ ⠒⠊⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
317- ⠀⠀⠀⠀⠀⠀⠀⠀⠀⢇ ⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀ ⠤2⠒⠉⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
318- ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⡀⠀⣀⡠⠤ ⠒⠊⠉⠁ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
319- ⠀⠀⠀⠀⠀⠀ Z̃ (3 , 2 )⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
308+ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀Z̃ ( 3 , 1 ) ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
309+ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠔⠁⠀⠀⠀⠉⠉⠑⠒⠒⠢⠤⠤⣀⣀⡀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
310+ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠔⠁ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈2⠉⠑ ⠒⠒⠤⠤⠤⣀⣀⡀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀
311+ ⠀⠀⠀⠀⠀⠀⠀⠀⠀ ( 2 ) ' ⠁ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ Z̃ (3 , 2 )⠀⠀
312+ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠔⠁ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠤⠊ ⠀⠀⠀⠀⠀⠀⠀
313+ ⠀⠀⠀⠀⠀⠀⠀⢀⠔⠁ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡠⠒ ⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀
314+ ⠀⠀⠀⠀⠀⢀⠔⠁⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀2⠊ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
315+ ⠀Z̃ ( 2 , 1 )⠤⠤⣀⣀⣀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡠⠊⠁ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
316+ ⠀⠀⠀⠀⠀⢣⠀⠀ ⠀⠀⠀⠀⠀⠀⠉⠉⠑⠒2⠢⠤⠤⣀⣀⡀ ⠀⠀⠀⠀⠀⠀⠀⣀⠔⠉⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
317+ ⠀⠀⠀⠀⠀⢸ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉ Z̃ (2 , 2 )⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
318+ ⠀⠀⠀⠀⠀2⡄ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⠤⠤ ⠒⠊⠉⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
319+ ⠀⠀⠀⠀⠀⠀⡇ ⠀⠀⠀⠀⠀⠀⠀⠀⣀⡠ ⠤2⠒⠉⠁⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
320+ ⠀⠀⠀⠀⠀⠀⢱⠀⢀⣀⠤⠔ ⠒⠊⠉⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
321+ ⠀⠀Z̃ (1 , 2 )⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
320322 ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
321323 ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
322324 ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
@@ -328,7 +330,7 @@ julia> @visualize Z̃;
328330
329331
330332
331- This file was generated with [weave .jl](https://github.com/JunoLab/Weave.jl) with the following commands:
333+ This file was generated with [Weave .jl](https://github.com/JunoLab/Weave.jl) with the following commands:
332334
333335``` julia
334336using ITensorNetworks: ITensorNetworks
0 commit comments