@@ -32,15 +32,13 @@ julia> ] add ITensorNetworks
32
32
Here are is an example of making a tensor network on a chain graph (a tensor train or matrix product state):
33
33
34
34
``` julia
35
- julia> using Graphs: neighbors
35
+ julia> using Graphs: neighbors, path_graph
36
36
37
- julia> using ITensorNetworks: ITensorNetwork, siteinds
37
+ julia> using ITensorNetworks: ITensorNetwork
38
38
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 )
42
40
ITensorNetworks. ITensorNetwork{Int64} with 4 vertices:
43
- 4 - element Vector {Int64}:
41
+ 4 - element Dictionaries . Indices {Int64}
44
42
1
45
43
2
46
44
3
@@ -89,9 +87,13 @@ julia> neighbors(tn, 4)
89
87
and here is a similar example for making a tensor network on a grid (a tensor product state or project entangled pair state (PEPS)):
90
88
91
89
``` julia
90
+ julia> using NamedGraphs. GraphsExtensions: subgraph
91
+
92
+ julia> using NamedGraphs. NamedGraphGenerators: named_grid
93
+
92
94
julia> tn = ITensorNetwork (named_grid ((2 , 2 )); link_space= 2 )
93
95
ITensorNetworks. ITensorNetwork{Tuple{Int64, Int64}} with 4 vertices:
94
- 4 - element Vector {Tuple{Int64, Int64}}:
96
+ 4 - element Dictionaries . Indices {Tuple{Int64, Int64}}
95
97
(1 , 1 )
96
98
(2 , 1 )
97
99
(1 , 2 )
@@ -126,7 +128,7 @@ julia> neighbors(tn, (1, 2))
126
128
127
129
julia> tn_1 = subgraph (v -> v[1 ] == 1 , tn)
128
130
ITensorNetworks. ITensorNetwork{Tuple{Int64, Int64}} with 2 vertices:
129
- 2 - element Vector {Tuple{Int64, Int64}}:
131
+ 2 - element Dictionaries . Indices {Tuple{Int64, Int64}}
130
132
(1 , 1 )
131
133
(1 , 2 )
132
134
@@ -140,7 +142,7 @@ with vertex data:
140
142
141
143
julia> tn_2 = subgraph (v -> v[1 ] == 2 , tn)
142
144
ITensorNetworks. ITensorNetwork{Tuple{Int64, Int64}} with 2 vertices:
143
- 2 - element Vector {Tuple{Int64, Int64}}:
145
+ 2 - element Dictionaries . Indices {Tuple{Int64, Int64}}
144
146
(2 , 1 )
145
147
(2 , 2 )
146
148
@@ -159,13 +161,13 @@ Networks can also be merged/unioned:
159
161
``` julia
160
162
julia> using ITensors: prime
161
163
162
- julia> using ITensorNetworks: ⊗ , contract, contraction_sequence
164
+ julia> using ITensorNetworks: ⊗ , contract, contraction_sequence, siteinds
163
165
164
166
julia> using ITensorUnicodePlots: @visualize
165
167
166
168
julia> s = siteinds (" S=1/2" , named_grid (3 ))
167
169
ITensorNetworks. IndsNetwork{Int64, ITensors. Index} with 3 vertices:
168
- 3 - element Vector {Int64}:
170
+ 3 - element Dictionaries . Indices {Int64}
169
171
1
170
172
2
171
173
3
@@ -185,7 +187,7 @@ and edge data:
185
187
186
188
julia> tn1 = ITensorNetwork (s; link_space= 2 )
187
189
ITensorNetworks. ITensorNetwork{Int64} with 3 vertices:
188
- 3 - element Vector {Int64}:
190
+ 3 - element Dictionaries . Indices {Int64}
189
191
1
190
192
2
191
193
3
@@ -202,7 +204,7 @@ with vertex data:
202
204
203
205
julia> tn2 = ITensorNetwork(s; link_space=2)
204
206
ITensorNetworks.ITensorNetwork{Int64} with 3 vertices:
205
- 3-element Vector {Int64}:
207
+ 3-element Dictionaries.Indices {Int64}
206
208
1
207
209
2
208
210
3
@@ -293,8 +295,8 @@ julia> @visualize Z;
293
295
294
296
julia> contraction_sequence (Z)
295
297
2 - 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 ))]]]
298
300
299
301
julia> Z̃ = contract (Z, (1 , 1 ) => (2 , 1 ));
300
302
@@ -303,20 +305,20 @@ julia> @visualize Z̃;
303
305
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
304
306
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
305
307
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
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 )⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
320
322
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
321
323
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
322
324
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
@@ -328,7 +330,7 @@ julia> @visualize Z̃;
328
330
329
331
330
332
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:
332
334
333
335
``` julia
334
336
using ITensorNetworks: ITensorNetworks
0 commit comments