tensor-network-visualization 2.0.3__py3-none-any.whl → 2.0.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {tensor_network_visualization-2.0.3.dist-info → tensor_network_visualization-2.0.4.dist-info}/METADATA +307 -300
- tensor_network_visualization-2.0.4.dist-info/RECORD +122 -0
- {tensor_network_visualization-2.0.3.dist-info → tensor_network_visualization-2.0.4.dist-info}/WHEEL +1 -1
- tensor_network_viz/__init__.py +276 -276
- tensor_network_viz/_auto_display.py +54 -54
- tensor_network_viz/_contraction_viewer_style.py +202 -202
- tensor_network_viz/_contraction_viewer_ui.py +149 -149
- tensor_network_viz/_core/_draw_common.py +9 -9
- tensor_network_viz/_core/_label_format.py +195 -195
- tensor_network_viz/_core/_nodes_edges_common.py +174 -174
- tensor_network_viz/_core/axis_directions.py +50 -50
- tensor_network_viz/_core/contractions.py +114 -114
- tensor_network_viz/_core/curves.py +64 -64
- tensor_network_viz/_core/draw/__init__.py +46 -46
- tensor_network_viz/_core/draw/constants.py +138 -138
- tensor_network_viz/_core/draw/contraction_edges.py +152 -152
- tensor_network_viz/_core/draw/contraction_scheme.py +884 -884
- tensor_network_viz/_core/draw/dangling_self_edges.py +490 -490
- tensor_network_viz/_core/draw/edge_labels.py +150 -150
- tensor_network_viz/_core/draw/edges.py +16 -16
- tensor_network_viz/_core/draw/fonts_and_scale.py +315 -315
- tensor_network_viz/_core/draw/graph_pipeline.py +266 -266
- tensor_network_viz/_core/draw/hover.py +426 -426
- tensor_network_viz/_core/draw/label_descriptors.py +56 -56
- tensor_network_viz/_core/draw/labels_misc.py +167 -167
- tensor_network_viz/_core/draw/plotter.py +68 -68
- tensor_network_viz/_core/draw/plotter_2d.py +229 -229
- tensor_network_viz/_core/draw/plotter_3d.py +209 -209
- tensor_network_viz/_core/draw/plotter_common.py +85 -85
- tensor_network_viz/_core/draw/render_prep.py +595 -595
- tensor_network_viz/_core/draw/scene_state.py +70 -70
- tensor_network_viz/_core/draw/tensors.py +299 -299
- tensor_network_viz/_core/draw/vectors.py +39 -39
- tensor_network_viz/_core/draw/viewport_geometry.py +732 -732
- tensor_network_viz/_core/focus.py +323 -323
- tensor_network_viz/_core/graph.py +325 -325
- tensor_network_viz/_core/graph_cache.py +206 -206
- tensor_network_viz/_core/layout/__init__.py +17 -17
- tensor_network_viz/_core/layout/body.py +150 -150
- tensor_network_viz/_core/layout/direction_common.py +550 -550
- tensor_network_viz/_core/layout/force_directed.py +247 -247
- tensor_network_viz/_core/layout/free_directions_2d.py +1096 -1096
- tensor_network_viz/_core/layout/free_directions_3d.py +844 -844
- tensor_network_viz/_core/layout/generic_coarsening.py +779 -779
- tensor_network_viz/_core/layout/geometry.py +403 -403
- tensor_network_viz/_core/layout/parameters.py +64 -64
- tensor_network_viz/_core/layout/positions.py +1199 -1199
- tensor_network_viz/_core/layout/types.py +13 -13
- tensor_network_viz/_core/layout_structure.py +1117 -1095
- tensor_network_viz/_core/layout_structure_coordinates.py +208 -208
- tensor_network_viz/_core/layout_structure_sparse_grid.py +222 -222
- tensor_network_viz/_core/renderer.py +633 -633
- tensor_network_viz/_engine_specs.py +44 -44
- tensor_network_viz/_import_state.py +37 -37
- tensor_network_viz/_input_inspection.py +538 -538
- tensor_network_viz/_interaction/__init__.py +3 -3
- tensor_network_viz/_interaction/bridge.py +180 -180
- tensor_network_viz/_interaction/controller.py +912 -912
- tensor_network_viz/_interaction/controls.py +369 -369
- tensor_network_viz/_interaction/scheme.py +234 -234
- tensor_network_viz/_interaction/state.py +155 -155
- tensor_network_viz/_interaction/tensor_inspector.py +760 -760
- tensor_network_viz/_interaction/views.py +219 -219
- tensor_network_viz/_interactive_scene.py +762 -762
- tensor_network_viz/_logging.py +16 -16
- tensor_network_viz/_matplotlib_state.py +84 -84
- tensor_network_viz/_registry.py +86 -86
- tensor_network_viz/_tensor_comparison_support.py +147 -147
- tensor_network_viz/_tensor_elements_controller.py +1148 -1148
- tensor_network_viz/_tensor_elements_data.py +862 -863
- tensor_network_viz/_tensor_elements_inputs.py +586 -586
- tensor_network_viz/_tensor_elements_models.py +137 -137
- tensor_network_viz/_tensor_elements_payloads.py +913 -913
- tensor_network_viz/_tensor_elements_rendering.py +341 -341
- tensor_network_viz/_tensor_elements_support.py +55 -55
- tensor_network_viz/_translation_codegen.py +322 -322
- tensor_network_viz/_translation_models.py +41 -41
- tensor_network_viz/_typing.py +31 -31
- tensor_network_viz/_ui_utils.py +157 -157
- tensor_network_viz/_widgets.py +38 -38
- tensor_network_viz/config.py +355 -355
- tensor_network_viz/contraction_viewer.py +1013 -1007
- tensor_network_viz/einsum_module/__init__.py +46 -46
- tensor_network_viz/einsum_module/_backend.py +57 -57
- tensor_network_viz/einsum_module/_equation.py +332 -332
- tensor_network_viz/einsum_module/_trace_state.py +302 -302
- tensor_network_viz/einsum_module/_trace_types.py +77 -77
- tensor_network_viz/einsum_module/contraction_cost.py +170 -170
- tensor_network_viz/einsum_module/graph.py +381 -381
- tensor_network_viz/einsum_module/renderer.py +17 -17
- tensor_network_viz/einsum_module/trace.py +177 -177
- tensor_network_viz/exceptions.py +47 -47
- tensor_network_viz/interactive_viewer.py +7 -7
- tensor_network_viz/quimb/__init__.py +32 -32
- tensor_network_viz/quimb/graph.py +165 -165
- tensor_network_viz/quimb/renderer.py +17 -17
- tensor_network_viz/snapshot.py +353 -353
- tensor_network_viz/tenpy/__init__.py +37 -37
- tensor_network_viz/tenpy/explicit.py +73 -73
- tensor_network_viz/tenpy/graph.py +197 -197
- tensor_network_viz/tenpy/renderer.py +17 -17
- tensor_network_viz/tensor_comparison.py +244 -244
- tensor_network_viz/tensor_comparison_config.py +42 -42
- tensor_network_viz/tensor_elements.py +301 -301
- tensor_network_viz/tensor_elements_config.py +308 -308
- tensor_network_viz/tensorkrowch/__init__.py +32 -32
- tensor_network_viz/tensorkrowch/_history.py +395 -395
- tensor_network_viz/tensorkrowch/graph.py +40 -40
- tensor_network_viz/tensornetwork/__init__.py +32 -32
- tensor_network_viz/tensornetwork/graph.py +20 -20
- tensor_network_viz/translation.py +262 -262
- tensor_network_viz/viewer.py +253 -253
- tensor_network_visualization-2.0.3.dist-info/RECORD +0 -122
- {tensor_network_visualization-2.0.3.dist-info → tensor_network_visualization-2.0.4.dist-info}/licenses/LICENSE +0 -0
- {tensor_network_visualization-2.0.3.dist-info → tensor_network_visualization-2.0.4.dist-info}/top_level.txt +0 -0
|
@@ -1,300 +1,307 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: tensor-network-visualization
|
|
3
|
-
Version: 2.0.
|
|
4
|
-
Summary: Minimal Matplotlib visualizations for TensorKrowch, TensorNetwork, Quimb, TeNPy, and traced PyTorch/NumPy einsum tensor networks.
|
|
5
|
-
Author: Alejandro Mata Ali
|
|
6
|
-
License-Expression: MIT
|
|
7
|
-
Project-URL: Homepage, https://github.com/DOKOS-TAYOS/Tensor-Network-Visualization
|
|
8
|
-
Project-URL: Documentation, https://github.com/DOKOS-TAYOS/Tensor-Network-Visualization/blob/main/docs/guide.md
|
|
9
|
-
Project-URL: Changelog, https://github.com/DOKOS-TAYOS/Tensor-Network-Visualization/blob/main/CHANGELOG.md
|
|
10
|
-
Project-URL: Repository, https://github.com/DOKOS-TAYOS/Tensor-Network-Visualization
|
|
11
|
-
Project-URL: Issues, https://github.com/DOKOS-TAYOS/Tensor-Network-Visualization/issues
|
|
12
|
-
Keywords: tensor-network,visualization,pytorch,numpy,tensorkrowch,tensornetwork,quimb,tenpy,einsum,quantum-inspired,matplotlib
|
|
13
|
-
Classifier: Development Status :: 5 - Production/Stable
|
|
14
|
-
Classifier: Intended Audience :: Science/Research
|
|
15
|
-
Classifier: Operating System :: OS Independent
|
|
16
|
-
Classifier: Programming Language :: Python :: 3
|
|
17
|
-
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
-
Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
22
|
-
Classifier: Typing :: Typed
|
|
23
|
-
Requires-Python: >=3.11
|
|
24
|
-
Description-Content-Type: text/markdown
|
|
25
|
-
License-File: LICENSE
|
|
26
|
-
Requires-Dist: matplotlib>=3.
|
|
27
|
-
Requires-Dist: networkx>=3.
|
|
28
|
-
Requires-Dist:
|
|
29
|
-
|
|
30
|
-
Requires-Dist:
|
|
31
|
-
|
|
32
|
-
Requires-Dist:
|
|
33
|
-
Requires-Dist:
|
|
34
|
-
Requires-Dist:
|
|
35
|
-
Requires-Dist:
|
|
36
|
-
Requires-Dist:
|
|
37
|
-
Requires-Dist:
|
|
38
|
-
Requires-Dist:
|
|
39
|
-
Requires-Dist:
|
|
40
|
-
Requires-Dist:
|
|
41
|
-
Requires-Dist:
|
|
42
|
-
Requires-Dist:
|
|
43
|
-
|
|
44
|
-
Requires-Dist:
|
|
45
|
-
|
|
46
|
-
Requires-Dist:
|
|
47
|
-
Requires-Dist:
|
|
48
|
-
|
|
49
|
-
Requires-Dist:
|
|
50
|
-
Provides-Extra:
|
|
51
|
-
Requires-Dist:
|
|
52
|
-
Provides-Extra:
|
|
53
|
-
Requires-Dist:
|
|
54
|
-
Provides-Extra:
|
|
55
|
-
Requires-Dist:
|
|
56
|
-
Provides-Extra:
|
|
57
|
-
Requires-Dist:
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
trace
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
- [
|
|
249
|
-
|
|
250
|
-
- [
|
|
251
|
-
|
|
252
|
-
- [
|
|
253
|
-
|
|
254
|
-
- [
|
|
255
|
-
|
|
256
|
-
- [
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
- `
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
- [
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tensor-network-visualization
|
|
3
|
+
Version: 2.0.4
|
|
4
|
+
Summary: Minimal Matplotlib visualizations for TensorKrowch, TensorNetwork, Quimb, TeNPy, and traced PyTorch/NumPy einsum tensor networks.
|
|
5
|
+
Author: Alejandro Mata Ali
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/DOKOS-TAYOS/Tensor-Network-Visualization
|
|
8
|
+
Project-URL: Documentation, https://github.com/DOKOS-TAYOS/Tensor-Network-Visualization/blob/main/docs/guide.md
|
|
9
|
+
Project-URL: Changelog, https://github.com/DOKOS-TAYOS/Tensor-Network-Visualization/blob/main/CHANGELOG.md
|
|
10
|
+
Project-URL: Repository, https://github.com/DOKOS-TAYOS/Tensor-Network-Visualization
|
|
11
|
+
Project-URL: Issues, https://github.com/DOKOS-TAYOS/Tensor-Network-Visualization/issues
|
|
12
|
+
Keywords: tensor-network,visualization,pytorch,numpy,tensorkrowch,tensornetwork,quimb,tenpy,einsum,quantum-inspired,matplotlib
|
|
13
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
22
|
+
Classifier: Typing :: Typed
|
|
23
|
+
Requires-Python: >=3.11
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Requires-Dist: matplotlib>=3.11.2
|
|
27
|
+
Requires-Dist: networkx>=3.6.1; python_version < "3.12"
|
|
28
|
+
Requires-Dist: networkx>=3.7; python_version >= "3.12"
|
|
29
|
+
Requires-Dist: numpy>=2.4.5; python_version < "3.12"
|
|
30
|
+
Requires-Dist: numpy>=2.5.5; python_version >= "3.12"
|
|
31
|
+
Provides-Extra: dev
|
|
32
|
+
Requires-Dist: bandit>=1.9.4; extra == "dev"
|
|
33
|
+
Requires-Dist: build>=1.6.1; extra == "dev"
|
|
34
|
+
Requires-Dist: pytest>=9.2.0; extra == "dev"
|
|
35
|
+
Requires-Dist: ruff>=0.17.5; extra == "dev"
|
|
36
|
+
Requires-Dist: setuptools>=84.2.1; extra == "dev"
|
|
37
|
+
Requires-Dist: pyright>=1.1.414; extra == "dev"
|
|
38
|
+
Requires-Dist: pip-audit>=2.10.1; extra == "dev"
|
|
39
|
+
Requires-Dist: twine>=7.0.0; extra == "dev"
|
|
40
|
+
Requires-Dist: ipython>=9.18.1; extra == "dev"
|
|
41
|
+
Requires-Dist: tensorkrowch>=1.1; extra == "dev"
|
|
42
|
+
Requires-Dist: tensornetwork>=0.4; extra == "dev"
|
|
43
|
+
Requires-Dist: quimb>=1.7; extra == "dev"
|
|
44
|
+
Requires-Dist: physics-tenpy>=1.0.6; extra == "dev"
|
|
45
|
+
Provides-Extra: jupyter
|
|
46
|
+
Requires-Dist: ipympl>=0.9.0; extra == "jupyter"
|
|
47
|
+
Requires-Dist: ipywidgets>=8.0; extra == "jupyter"
|
|
48
|
+
Requires-Dist: jupyterlab>=4.0; extra == "jupyter"
|
|
49
|
+
Requires-Dist: notebook>=7.0; extra == "jupyter"
|
|
50
|
+
Provides-Extra: tensorkrowch
|
|
51
|
+
Requires-Dist: tensorkrowch>=1.1; extra == "tensorkrowch"
|
|
52
|
+
Provides-Extra: tensornetwork
|
|
53
|
+
Requires-Dist: tensornetwork>=0.4; extra == "tensornetwork"
|
|
54
|
+
Provides-Extra: quimb
|
|
55
|
+
Requires-Dist: quimb>=1.7; extra == "quimb"
|
|
56
|
+
Provides-Extra: tenpy
|
|
57
|
+
Requires-Dist: physics-tenpy>=1.0.6; extra == "tenpy"
|
|
58
|
+
Provides-Extra: einsum
|
|
59
|
+
Requires-Dist: torch>=2.0; extra == "einsum"
|
|
60
|
+
Dynamic: license-file
|
|
61
|
+
|
|
62
|
+
<p align="center">
|
|
63
|
+
<img
|
|
64
|
+
src="https://raw.githubusercontent.com/DOKOS-TAYOS/Tensor-Network-Visualization/main/images/tensor_network_visualization_logo.png"
|
|
65
|
+
alt="Tensor-Network-Visualization logo"
|
|
66
|
+
width="420"
|
|
67
|
+
>
|
|
68
|
+
</p>
|
|
69
|
+
|
|
70
|
+
<p align="center"><em>Logo:</em> original project artwork by Alejandro Mata Ali; covered by the same MIT license as this repository.</p>
|
|
71
|
+
|
|
72
|
+
# Tensor-Network-Visualization
|
|
73
|
+
|
|
74
|
+
[](https://github.com/DOKOS-TAYOS/Tensor-Network-Visualization/actions/workflows/ci.yml)
|
|
75
|
+
[](https://pypi.org/project/tensor-network-visualization/)
|
|
76
|
+
[](https://pypi.org/project/tensor-network-visualization/)
|
|
77
|
+
[](https://opensource.org/licenses/MIT)
|
|
78
|
+
|
|
79
|
+
Minimal Matplotlib visualizations for TensorKrowch, TensorNetwork, Quimb, TeNPy, and traced
|
|
80
|
+
PyTorch/NumPy `einsum` tensor networks.
|
|
81
|
+
|
|
82
|
+
## Gallery
|
|
83
|
+
|
|
84
|
+
These are exports generated with the library and the repository demos.
|
|
85
|
+
|
|
86
|
+
<p align="center">
|
|
87
|
+
<img
|
|
88
|
+
src="https://raw.githubusercontent.com/DOKOS-TAYOS/Tensor-Network-Visualization/main/images/gallery/cubic_peps_3d.png"
|
|
89
|
+
alt="Cubic PEPS 3D tensor network visualization"
|
|
90
|
+
width="230"
|
|
91
|
+
>
|
|
92
|
+
<img
|
|
93
|
+
src="https://raw.githubusercontent.com/DOKOS-TAYOS/Tensor-Network-Visualization/main/images/gallery/mera_2d.png"
|
|
94
|
+
alt="MERA 2D tensor network visualization with labels"
|
|
95
|
+
width="230"
|
|
96
|
+
>
|
|
97
|
+
<img
|
|
98
|
+
src="https://raw.githubusercontent.com/DOKOS-TAYOS/Tensor-Network-Visualization/main/images/gallery/tubular_grid_3d.png"
|
|
99
|
+
alt="Tubular 3D tensor network visualization"
|
|
100
|
+
width="230"
|
|
101
|
+
>
|
|
102
|
+
</p>
|
|
103
|
+
|
|
104
|
+
<p align="center">
|
|
105
|
+
<img
|
|
106
|
+
src="https://raw.githubusercontent.com/DOKOS-TAYOS/Tensor-Network-Visualization/main/images/gallery/network_controls.png"
|
|
107
|
+
alt="MPS with controls, tensor labels, and index labels"
|
|
108
|
+
width="230"
|
|
109
|
+
>
|
|
110
|
+
<img
|
|
111
|
+
src="https://raw.githubusercontent.com/DOKOS-TAYOS/Tensor-Network-Visualization/main/images/gallery/tensor_elements_phase.png"
|
|
112
|
+
alt="Tensor elements phase visualization"
|
|
113
|
+
width="230"
|
|
114
|
+
>
|
|
115
|
+
<img
|
|
116
|
+
src="https://raw.githubusercontent.com/DOKOS-TAYOS/Tensor-Network-Visualization/main/images/gallery/tensor_elements_controls.png"
|
|
117
|
+
alt="Tensor elements view with the full control menus"
|
|
118
|
+
width="230"
|
|
119
|
+
>
|
|
120
|
+
</p>
|
|
121
|
+
|
|
122
|
+
## Why This Exists
|
|
123
|
+
|
|
124
|
+
Tensor-network libraries expose different Python objects. This package gives them a small shared
|
|
125
|
+
visualization API so you can inspect structure, tensor values, contraction playback, and normalized
|
|
126
|
+
graph exports without rewriting plotting code for every backend.
|
|
127
|
+
|
|
128
|
+
The common entry points are:
|
|
129
|
+
|
|
130
|
+
```python
|
|
131
|
+
show_tensor_network(...)
|
|
132
|
+
show_tensor_elements(...)
|
|
133
|
+
show_tensor_comparison(...)
|
|
134
|
+
translate_tensor_network(...)
|
|
135
|
+
normalize_tensor_network(...)
|
|
136
|
+
export_tensor_network_snapshot(...)
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
If you want code for another backend rather than a figure, `translate_tensor_network(...)` can turn
|
|
140
|
+
supported TensorKrowch, TensorNetwork, Quimb, TeNPy, and traced `einsum` inputs into executable
|
|
141
|
+
Python for `tensornetwork`, `quimb`, `einsum`, or `tensorkrowch`.
|
|
142
|
+
|
|
143
|
+
## Install
|
|
144
|
+
|
|
145
|
+
- PyPI package name: `tensor-network-visualization`
|
|
146
|
+
- Import package: `tensor_network_viz`
|
|
147
|
+
- Requires Python 3.11 or newer.
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
python -m pip install tensor-network-visualization
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
The base install only depends on `numpy`, `matplotlib`, and `networkx`.
|
|
154
|
+
|
|
155
|
+
For interactive Jupyter figures:
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
python -m pip install "tensor-network-visualization[jupyter]"
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
For backend-specific packages, install the matching extra, for example:
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
python -m pip install "tensor-network-visualization[quimb]"
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
See [docs/installation.md](docs/installation.md) for virtual environments, all optional extras, and
|
|
168
|
+
local development installs.
|
|
169
|
+
|
|
170
|
+
## Basic Usage
|
|
171
|
+
|
|
172
|
+
### NumPy `einsum` trace (base install)
|
|
173
|
+
|
|
174
|
+
This example uses only base dependencies and a NumPy-backed `EinsumTrace`.
|
|
175
|
+
|
|
176
|
+
```python
|
|
177
|
+
import numpy as np
|
|
178
|
+
from tensor_network_viz import EinsumTrace, PlotConfig, einsum, show_tensor_network
|
|
179
|
+
|
|
180
|
+
trace = EinsumTrace()
|
|
181
|
+
a = np.ones((2, 3), dtype=float)
|
|
182
|
+
x = np.array([1.0, -0.5, 0.25], dtype=float)
|
|
183
|
+
|
|
184
|
+
trace.bind("A", a)
|
|
185
|
+
trace.bind("x", x)
|
|
186
|
+
einsum("ab,b->a", a, x, trace=trace, backend="numpy")
|
|
187
|
+
|
|
188
|
+
fig, ax = show_tensor_network(
|
|
189
|
+
trace,
|
|
190
|
+
config=PlotConfig(show_tensor_labels=True, hover_labels=True),
|
|
191
|
+
show=False,
|
|
192
|
+
)
|
|
193
|
+
fig.savefig("einsum-network.png", bbox_inches="tight")
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### TensorKrowch
|
|
197
|
+
|
|
198
|
+
Install the TensorKrowch extra (see [Installation](docs/installation.md) for details):
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
python -m pip install "tensor-network-visualization[tensorkrowch]"
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
```python
|
|
205
|
+
import tensorkrowch as tk
|
|
206
|
+
from tensor_network_viz import PlotConfig, show_tensor_network
|
|
207
|
+
|
|
208
|
+
network = tk.TensorNetwork(name="demo")
|
|
209
|
+
left = tk.Node(shape=(2, 2), axes_names=("a", "b"), name="L", network=network)
|
|
210
|
+
right = tk.Node(shape=(2, 2), axes_names=("b", "c"), name="R", network=network)
|
|
211
|
+
left["b"] ^ right["b"]
|
|
212
|
+
|
|
213
|
+
fig, ax = show_tensor_network(
|
|
214
|
+
network,
|
|
215
|
+
config=PlotConfig(show_tensor_labels=True, show_index_labels=False),
|
|
216
|
+
show=False,
|
|
217
|
+
)
|
|
218
|
+
fig.savefig("tensorkrowch-network.png", bbox_inches="tight")
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
Use `show=False` when you want to save or customize the figure yourself. Use
|
|
222
|
+
`show_controls=False` when you want a clean static figure with no embedded Matplotlib controls.
|
|
223
|
+
|
|
224
|
+
In a notebook, use this exact recipe:
|
|
225
|
+
|
|
226
|
+
```python
|
|
227
|
+
%pip install "tensor-network-visualization[jupyter]"
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
If you just installed that extra in the current kernel, restart the kernel once. Then, in the
|
|
231
|
+
first plotting cell:
|
|
232
|
+
|
|
233
|
+
```python
|
|
234
|
+
%matplotlib widget
|
|
235
|
+
|
|
236
|
+
from tensor_network_viz import PlotConfig, show_tensor_network
|
|
237
|
+
|
|
238
|
+
fig, ax = show_tensor_network(
|
|
239
|
+
network,
|
|
240
|
+
config=PlotConfig(show_tensor_labels=True, hover_labels=True),
|
|
241
|
+
)
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
See [Installation](docs/installation.md) and [User Guide](docs/guide.md) for details.
|
|
245
|
+
|
|
246
|
+
## Documentation
|
|
247
|
+
|
|
248
|
+
- [Installation](docs/installation.md): virtual environments, optional extras, Jupyter, and local
|
|
249
|
+
editable installs.
|
|
250
|
+
- [API Reference](docs/api.md): public functions, configuration objects, snapshots, exceptions, and
|
|
251
|
+
logging.
|
|
252
|
+
- [User Guide](docs/guide.md): workflows, notebooks, exports, layouts, tensor inspection,
|
|
253
|
+
comparisons, snapshots, and performance tips.
|
|
254
|
+
- [Layout Algorithms](docs/algorithms.md): node placement and free-edge direction rules in 2D and
|
|
255
|
+
3D.
|
|
256
|
+
- [Backend Examples](docs/backends.md): copy-paste examples for TensorKrowch, TensorNetwork, Quimb,
|
|
257
|
+
TeNPy, and `einsum`.
|
|
258
|
+
- [Troubleshooting](docs/troubleshooting.md): common install, Jupyter, Matplotlib, backend, and data
|
|
259
|
+
issues.
|
|
260
|
+
- [Repository Examples](examples/README.md): command-line demo launcher and example catalog.
|
|
261
|
+
- [Demo Commands](commands.md): copy-paste commands for every repository demo.
|
|
262
|
+
|
|
263
|
+
## Demo Gallery
|
|
264
|
+
|
|
265
|
+
The repository examples are organized around the same launcher:
|
|
266
|
+
|
|
267
|
+
```bash
|
|
268
|
+
python examples/run_demo.py <group> <demo>
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
The gallery includes backend demos for TensorKrowch, TensorNetwork, Quimb, TeNPy, and `einsum`,
|
|
272
|
+
plus three focused groups:
|
|
273
|
+
|
|
274
|
+
- `themes overview`: compares the `PlotConfig` visual presets for tensor-network figures.
|
|
275
|
+
- `themes tensor_elements`: compares the `TensorElementsConfig` presets for `show_tensor_elements(...)`
|
|
276
|
+
and the linked tensor inspector.
|
|
277
|
+
- `placements`: shows object, list, 2D grid, 3D grid, manual positions, manual schemes, and named
|
|
278
|
+
index inputs.
|
|
279
|
+
- `geometry`: renders larger irregular, incomplete, triangular, pyramidal, circular, and
|
|
280
|
+
disconnected networks.
|
|
281
|
+
|
|
282
|
+
There is also a dedicated translation demo:
|
|
283
|
+
|
|
284
|
+
```bash
|
|
285
|
+
python examples/translate_demo.py --source-engine tensornetwork --target-engine quimb --example mps
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
It generates Python code for the translated tensor network and can render the original and
|
|
289
|
+
translated versions side by side for comparison.
|
|
290
|
+
|
|
291
|
+
For batch checks, use:
|
|
292
|
+
|
|
293
|
+
```bash
|
|
294
|
+
python examples/run_all_examples.py --group engines --views 2d --list
|
|
295
|
+
python examples/run_all_examples.py --group all --views 2d --output-dir .tmp/examples
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
## Project Links
|
|
299
|
+
|
|
300
|
+
- [License](LICENSE) (MIT)
|
|
301
|
+
- [Third-party licenses](THIRD_PARTY_LICENSES.md)
|
|
302
|
+
- [Changelog](CHANGELOG.md)
|
|
303
|
+
- [Contributing](CONTRIBUTING.md)
|
|
304
|
+
- [Code of Conduct](CODE_OF_CONDUCT.md)
|
|
305
|
+
- [Citation](CITATION.cff)
|
|
306
|
+
- [Issues](https://github.com/DOKOS-TAYOS/Tensor-Network-Visualization/issues)
|
|
307
|
+
- [Repository](https://github.com/DOKOS-TAYOS/Tensor-Network-Visualization)
|