tensor-network-visualization 1.5.2__tar.gz → 1.5.4__tar.gz

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.
Files changed (173) hide show
  1. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/LICENSE +21 -21
  2. {tensor_network_visualization-1.5.2/src/tensor_network_visualization.egg-info → tensor_network_visualization-1.5.4}/PKG-INFO +237 -24
  3. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/README.md +236 -23
  4. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/pyproject.toml +2 -2
  5. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4/src/tensor_network_visualization.egg-info}/PKG-INFO +237 -24
  6. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_visualization.egg-info/SOURCES.txt +21 -0
  7. tensor_network_visualization-1.5.4/src/tensor_network_viz/__init__.py +227 -0
  8. tensor_network_visualization-1.5.4/src/tensor_network_viz/_contraction_viewer_style.py +202 -0
  9. tensor_network_visualization-1.5.4/src/tensor_network_viz/_contraction_viewer_ui.py +128 -0
  10. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/__init__.py +1 -1
  11. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/_nodes_edges_common.py +37 -1
  12. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/contractions.py +114 -122
  13. tensor_network_visualization-1.5.4/src/tensor_network_viz/_core/draw/contraction_scheme.py +743 -0
  14. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/draw/dangling_self_edges.py +7 -1
  15. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/draw/disk_metrics.py +73 -73
  16. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/draw/edge_labels.py +1 -0
  17. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/draw/graph_pipeline.py +37 -106
  18. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/draw/hover.py +17 -14
  19. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/draw/pick_distance.py +82 -82
  20. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/draw/plotter.py +146 -40
  21. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/draw/render_prep.py +111 -1
  22. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/draw/scene_state.py +6 -1
  23. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/draw/tensors.py +60 -15
  24. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/draw/vectors.py +33 -33
  25. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/draw/viewport_geometry.py +3 -0
  26. tensor_network_visualization-1.5.4/src/tensor_network_viz/_core/focus.py +268 -0
  27. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/graph.py +126 -4
  28. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/graph_cache.py +10 -0
  29. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/graph_utils.py +95 -95
  30. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/layout/direction_common.py +528 -528
  31. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/layout/free_directions_2d.py +958 -920
  32. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/layout/positions.py +5 -0
  33. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/renderer.py +137 -25
  34. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_engine_specs.py +8 -0
  35. tensor_network_visualization-1.5.4/src/tensor_network_viz/_input_inspection.py +266 -0
  36. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_interaction/bridge.py +3 -0
  37. tensor_network_visualization-1.5.4/src/tensor_network_viz/_interaction/controller.py +771 -0
  38. tensor_network_visualization-1.5.4/src/tensor_network_viz/_interaction/controls.py +370 -0
  39. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_interaction/scheme.py +46 -57
  40. tensor_network_visualization-1.5.4/src/tensor_network_viz/_interaction/state.py +155 -0
  41. tensor_network_visualization-1.5.4/src/tensor_network_viz/_interaction/tensor_inspector.py +668 -0
  42. tensor_network_visualization-1.5.4/src/tensor_network_viz/_interaction/views.py +213 -0
  43. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_interactive_scene.py +265 -21
  44. tensor_network_visualization-1.5.4/src/tensor_network_viz/_logging.py +16 -0
  45. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_matplotlib_state.py +25 -0
  46. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_registry.py +31 -4
  47. tensor_network_visualization-1.5.4/src/tensor_network_viz/_tensor_comparison_support.py +138 -0
  48. tensor_network_visualization-1.5.4/src/tensor_network_viz/_tensor_elements_controller.py +676 -0
  49. tensor_network_visualization-1.5.4/src/tensor_network_viz/_tensor_elements_data.py +1521 -0
  50. tensor_network_visualization-1.5.4/src/tensor_network_viz/_tensor_elements_payloads.py +844 -0
  51. tensor_network_visualization-1.5.4/src/tensor_network_viz/_tensor_elements_rendering.py +290 -0
  52. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_tensor_elements_support.py +9 -3
  53. tensor_network_visualization-1.5.4/src/tensor_network_viz/_widgets.py +26 -0
  54. tensor_network_visualization-1.5.4/src/tensor_network_viz/config.py +161 -0
  55. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/contraction_viewer.py +141 -491
  56. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/einsum_module/_backend.py +14 -4
  57. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/einsum_module/_equation.py +4 -4
  58. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/einsum_module/_trace_state.py +68 -38
  59. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/einsum_module/contraction_cost.py +32 -12
  60. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/einsum_module/graph.py +66 -9
  61. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/einsum_module/trace.py +49 -20
  62. tensor_network_visualization-1.5.4/src/tensor_network_viz/exceptions.py +47 -0
  63. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/quimb/graph.py +17 -1
  64. tensor_network_visualization-1.5.4/src/tensor_network_viz/snapshot.py +345 -0
  65. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/tenpy/graph.py +21 -2
  66. tensor_network_visualization-1.5.4/src/tensor_network_viz/tensor_comparison.py +244 -0
  67. tensor_network_visualization-1.5.4/src/tensor_network_viz/tensor_comparison_config.py +42 -0
  68. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/tensor_elements.py +51 -4
  69. tensor_network_visualization-1.5.4/src/tensor_network_viz/tensor_elements_config.py +148 -0
  70. tensor_network_visualization-1.5.4/src/tensor_network_viz/tensorkrowch/_history.py +405 -0
  71. tensor_network_visualization-1.5.4/src/tensor_network_viz/tensorkrowch/graph.py +40 -0
  72. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/tensorkrowch/renderer.py +17 -17
  73. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/tensornetwork/renderer.py +17 -17
  74. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/viewer.py +36 -15
  75. tensor_network_visualization-1.5.4/tests/test_ci_workflow.py +176 -0
  76. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/tests/test_contraction_cost.py +47 -1
  77. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/tests/test_contraction_groups_once.py +7 -0
  78. tensor_network_visualization-1.5.4/tests/test_contraction_scheme.py +399 -0
  79. tensor_network_visualization-1.5.4/tests/test_contraction_scheme_api.py +22 -0
  80. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/tests/test_contraction_viewer.py +254 -89
  81. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/tests/test_demo_cli_scheme.py +97 -17
  82. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/tests/test_einsum_autotrace.py +103 -0
  83. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/tests/test_engine_detection.py +54 -3
  84. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/tests/test_engineering_baseline.py +89 -45
  85. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/tests/test_examples.py +195 -10
  86. tensor_network_visualization-1.5.4/tests/test_integration_tensorkrowch.py +139 -0
  87. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/tests/test_integration_tensornetwork.py +26 -26
  88. tensor_network_visualization-1.5.4/tests/test_interaction_controls.py +554 -0
  89. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/tests/test_interaction_state.py +233 -165
  90. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/tests/test_label_draw_metrics_perf.py +25 -0
  91. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/tests/test_layout_core.py +37 -0
  92. tensor_network_visualization-1.5.4/tests/test_logging_and_exceptions.py +171 -0
  93. tensor_network_visualization-1.5.4/tests/test_matplotlib_state.py +42 -0
  94. tensor_network_visualization-1.5.4/tests/test_packaging_metadata.py +49 -0
  95. tensor_network_visualization-1.5.4/tests/test_plotting.py +2816 -0
  96. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/tests/test_public_api.py +155 -8
  97. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/tests/test_render_performance_controls.py +97 -0
  98. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/tests/test_show_tensor_network_throughput.py +19 -2
  99. tensor_network_visualization-1.5.4/tests/test_snapshot_api.py +123 -0
  100. tensor_network_visualization-1.5.4/tests/test_tensor_comparison.py +163 -0
  101. tensor_network_visualization-1.5.4/tests/test_tensor_elements.py +2087 -0
  102. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/tests/test_tensor_elements_perf.py +19 -0
  103. tensor_network_visualization-1.5.4/tests/test_verify_script.py +61 -0
  104. tensor_network_visualization-1.5.2/src/tensor_network_viz/__init__.py +0 -105
  105. tensor_network_visualization-1.5.2/src/tensor_network_viz/_core/draw/contraction_scheme.py +0 -282
  106. tensor_network_visualization-1.5.2/src/tensor_network_viz/_input_inspection.py +0 -157
  107. tensor_network_visualization-1.5.2/src/tensor_network_viz/_interaction/controller.py +0 -662
  108. tensor_network_visualization-1.5.2/src/tensor_network_viz/_interaction/state.py +0 -88
  109. tensor_network_visualization-1.5.2/src/tensor_network_viz/_tensor_elements_controller.py +0 -605
  110. tensor_network_visualization-1.5.2/src/tensor_network_viz/_tensor_elements_data.py +0 -576
  111. tensor_network_visualization-1.5.2/src/tensor_network_viz/_tensor_elements_payloads.py +0 -658
  112. tensor_network_visualization-1.5.2/src/tensor_network_viz/config.py +0 -123
  113. tensor_network_visualization-1.5.2/src/tensor_network_viz/tensor_elements_config.py +0 -60
  114. tensor_network_visualization-1.5.2/src/tensor_network_viz/tensorkrowch/graph.py +0 -20
  115. tensor_network_visualization-1.5.2/tests/test_ci_workflow.py +0 -33
  116. tensor_network_visualization-1.5.2/tests/test_contraction_scheme.py +0 -141
  117. tensor_network_visualization-1.5.2/tests/test_integration_tensorkrowch.py +0 -26
  118. tensor_network_visualization-1.5.2/tests/test_packaging_metadata.py +0 -29
  119. tensor_network_visualization-1.5.2/tests/test_plotting.py +0 -1550
  120. tensor_network_visualization-1.5.2/tests/test_tensor_elements.py +0 -1104
  121. tensor_network_visualization-1.5.2/tests/test_verify_script.py +0 -24
  122. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/setup.cfg +0 -0
  123. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_visualization.egg-info/dependency_links.txt +0 -0
  124. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_visualization.egg-info/requires.txt +0 -0
  125. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_visualization.egg-info/top_level.txt +0 -0
  126. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/_draw_common.py +0 -0
  127. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/_label_format.py +0 -0
  128. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/axis_directions.py +0 -0
  129. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/curves.py +0 -0
  130. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/draw/__init__.py +0 -0
  131. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/draw/constants.py +0 -0
  132. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/draw/contraction_edges.py +0 -0
  133. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/draw/edge_orchestration.py +0 -0
  134. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/draw/edges.py +0 -0
  135. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/draw/fonts_and_scale.py +0 -0
  136. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/draw/label_descriptors.py +0 -0
  137. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/draw/labels_misc.py +0 -0
  138. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/layout/__init__.py +0 -0
  139. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/layout/body.py +0 -0
  140. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/layout/force_directed.py +0 -0
  141. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/layout/free_directions_3d.py +0 -0
  142. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/layout/geometry.py +0 -0
  143. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/layout/parameters.py +0 -0
  144. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/layout/types.py +0 -0
  145. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_core/layout_structure.py +0 -0
  146. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_interaction/__init__.py +0 -0
  147. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_typing.py +0 -0
  148. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/_ui_utils.py +0 -0
  149. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/einsum_module/__init__.py +0 -0
  150. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/einsum_module/_trace_types.py +0 -0
  151. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/einsum_module/renderer.py +0 -0
  152. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/interactive_viewer.py +0 -0
  153. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/py.typed +0 -0
  154. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/quimb/__init__.py +0 -0
  155. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/quimb/renderer.py +0 -0
  156. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/tenpy/__init__.py +0 -0
  157. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/tenpy/explicit.py +0 -0
  158. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/tenpy/renderer.py +0 -0
  159. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/tensorkrowch/__init__.py +0 -0
  160. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/tensornetwork/__init__.py +0 -0
  161. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/src/tensor_network_viz/tensornetwork/graph.py +0 -0
  162. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/tests/test_draw_performance.py +0 -0
  163. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/tests/test_edge_index_label_2d.py +0 -0
  164. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/tests/test_edge_index_label_3d.py +0 -0
  165. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/tests/test_einsum_backend.py +0 -0
  166. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/tests/test_examples_structure.py +0 -0
  167. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/tests/test_graph_cache.py +0 -0
  168. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/tests/test_integration_einsum.py +0 -0
  169. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/tests/test_label_format.py +0 -0
  170. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/tests/test_lazy_imports.py +0 -0
  171. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/tests/test_node_degrees_perf.py +0 -0
  172. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/tests/test_quimb_backend.py +0 -0
  173. {tensor_network_visualization-1.5.2 → tensor_network_visualization-1.5.4}/tests/test_tenpy_backend.py +0 -0
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Alejandro Mata Ali
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Alejandro Mata Ali
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tensor-network-visualization
3
- Version: 1.5.2
3
+ Version: 1.5.4
4
4
  Summary: Minimal Matplotlib visualizations for TensorKrowch, TensorNetwork, Quimb, TeNPy, and traced PyTorch/NumPy einsum tensor networks.
5
5
  Author: Alejandro Mata Ali
6
6
  License-Expression: MIT
@@ -63,12 +63,15 @@ PyTorch/NumPy `einsum` tensor networks.
63
63
 
64
64
  ## What This Library Does
65
65
 
66
- Tensor-network libraries expose very different Python objects, but this package gives them two
67
- aligned plotting entry points:
66
+ Tensor-network libraries expose very different Python objects, but this package gives them aligned
67
+ inspection and export entry points:
68
68
 
69
69
  ```python
70
70
  fig, ax = show_tensor_network(...)
71
71
  fig, ax = show_tensor_elements(...)
72
+ fig, ax = show_tensor_comparison(...)
73
+ graph = normalize_tensor_network(...)
74
+ snapshot = export_tensor_network_snapshot(...)
72
75
  ```
73
76
 
74
77
  Internally, the library:
@@ -79,7 +82,7 @@ Internally, the library:
79
82
  4. optionally adds figure controls for view/label/scheme toggles.
80
83
 
81
84
  The goal is to keep the public API small while still being useful for notebooks, papers, debugging,
82
- and saved figures.
85
+ saved figures, and external tooling that wants the backend-normalized graph model.
83
86
 
84
87
  ## Install
85
88
 
@@ -96,6 +99,36 @@ python -m pip install tensor-network-visualization
96
99
 
97
100
  Base dependencies are only `numpy`, `matplotlib`, and `networkx`.
98
101
 
102
+ ## Documentation Map
103
+
104
+ - Start here for installation and the public API overview.
105
+ - Use [`docs/guide.md`](docs/guide.md) for workflow-oriented explanations.
106
+ - Use [`docs/backends.md`](docs/backends.md) for backend-specific copy-paste examples.
107
+ - Use [`examples/README.md`](examples/README.md) when you want to run the local demos from this repository.
108
+
109
+ ## Errors and Logging
110
+
111
+ Public entry points now raise package-specific exceptions while remaining compatible with the
112
+ built-in exception families they refine:
113
+
114
+ - `VisualizationInputError`: unsupported or ambiguous network input.
115
+ - `AxisConfigurationError`: incompatible `ax` / `view` combinations.
116
+ - `UnsupportedEngineError`: unknown engine or backend name.
117
+ - `TensorDataError`: unsupported or missing tensor data for `show_tensor_elements(...)`.
118
+ - `MissingOptionalDependencyError`: missing optional backend dependency.
119
+
120
+ All of them inherit from `TensorNetworkVizError`.
121
+
122
+ The package logger name is `tensor_network_viz`. It installs a `logging.NullHandler()` by default,
123
+ so importing the library does not change your application's logging configuration.
124
+
125
+ ```python
126
+ import logging
127
+
128
+ logging.basicConfig(level=logging.DEBUG)
129
+ logging.getLogger("tensor_network_viz").setLevel(logging.DEBUG)
130
+ ```
131
+
99
132
  ### Optional extras
100
133
 
101
134
  | Need | Install |
@@ -127,8 +160,16 @@ python -m pip install -U pip
127
160
  python -m pip install "tensor-network-visualization[quimb]"
128
161
  ```
129
162
 
163
+ Once the virtual environment is active, the `python ...` commands shown in the rest of this
164
+ README work the same way on Windows and Linux.
165
+
130
166
  ## The API in One Minute
131
167
 
168
+ `show_controls` and `show` are independent:
169
+
170
+ - `show_controls=False` disables the embedded Matplotlib widgets and slider.
171
+ - `show=False` skips automatic display and only returns `(fig, ax)`.
172
+
132
173
  ### `show_tensor_network`
133
174
 
134
175
  Use `show_tensor_network` for figure lifecycle:
@@ -150,7 +191,7 @@ show_tensor_network(
150
191
  - `view`: `"2d"` or `"3d"`. If omitted, it starts in `"2d"`.
151
192
  - `config`: all visual behavior lives here.
152
193
  - `ax`: render into an existing Matplotlib axis.
153
- - `show_controls`: if `False`, the figure is saved/rendered without the embedded control panel.
194
+ - `show_controls`: if `False`, render a static figure without the embedded control panel.
154
195
  - `show`: if `False`, nothing is displayed automatically.
155
196
 
156
197
  ### `show_tensor_elements`
@@ -172,30 +213,97 @@ show_tensor_elements(
172
213
  When several tensors are present, the figure keeps one tensor active at a time and uses a slider
173
214
  to switch between them. The interactive controls are grouped: `basic` (`elements`, `magnitude`,
174
215
  `log_magnitude`, `distribution`, `data`), `complex` (`real`, `imag`, `phase`), and
175
- `diagnostic` (`sign`, `signed_value`, `sparsity`, `nan_inf`).
216
+ `diagnostic` (`sign`, `signed_value`, `sparsity`, `nan_inf`, `singular_values`, `eigen_real`,
217
+ `eigen_imag`), plus `analysis` (`slice`, `reduce`, `profiles`).
176
218
 
177
- - `data`: single tensor, iterable of tensors, supported backend-native tensor collections, or an
219
+ - `data`: direct numeric tensor input (for example a NumPy array), direct iterables of tensors
220
+ preserving order and duplicates, supported backend-native tensor collections, or an
178
221
  `EinsumTrace` with live tensor values.
179
222
  - `engine`: optional backend override. If omitted, the library auto-detects it.
180
223
  - `config`: tensor-inspection behavior lives here.
181
- - `data` mode now includes global stats, per-axis summaries, and top-k coordinates by magnitude.
224
+ - `data` mode includes global stats, per-axis summaries, and top-k coordinates by magnitude.
225
+ - `singular_values` renders the singular-value spectrum for the same matrixized tensor used by the
226
+ heatmap views and is hidden automatically when the active tensor contains `NaN` or `Inf`.
227
+ - `eigen_real` and `eigen_imag` render the real and imaginary parts of the eigenvalues for the same
228
+ matrixized tensor, ordered by eigenvalue magnitude. They appear only when the active analysis
229
+ matrix is finite and square.
182
230
  - `ax`: render a single tensor into an existing Matplotlib axis.
183
- - `show_controls`: if `True`, add compact Matplotlib `group + mode` controls and, when needed, a tensor slider.
231
+ - `show_controls`: if `True`, add compact Matplotlib `group + mode` controls and, when needed, a
232
+ tensor slider.
184
233
  - `show`: if `False`, nothing is displayed automatically.
185
234
 
235
+ ### `show_tensor_comparison`
236
+
237
+ Use `show_tensor_comparison` to compare one tensor against one reference tensor:
238
+
239
+ ```python
240
+ show_tensor_comparison(
241
+ data,
242
+ reference,
243
+ *,
244
+ engine=None,
245
+ config=None,
246
+ comparison_config=None,
247
+ ax=None,
248
+ show_controls=True,
249
+ show=True,
250
+ )
251
+ ```
252
+
253
+ - `config`: still uses `TensorElementsConfig(...)` for matrixization and rendering style.
254
+ - `comparison_config`: uses `TensorComparisonConfig(...)` for comparison-specific behavior.
255
+ - comparison modes are `reference`, `abs_diff`, `relative_diff`, `ratio`, `sign_change`,
256
+ `phase_change`, and `topk_changes`.
257
+
258
+ ### Normalized snapshots
259
+
260
+ Use the snapshot helpers when you want the backend-normalized graph and layout without touching any
261
+ backend adapter internals:
262
+
263
+ ```python
264
+ graph = normalize_tensor_network(network, engine=None)
265
+ snapshot = export_tensor_network_snapshot(
266
+ network,
267
+ engine=None,
268
+ view="2d",
269
+ config=PlotConfig(),
270
+ seed=0,
271
+ )
272
+ ```
273
+
274
+ Both snapshot objects are immutable and expose `.to_dict()` for serialization.
275
+
186
276
  ### `PlotConfig`
187
277
 
188
278
  Use `PlotConfig` for visual behavior:
189
279
 
190
280
  ```python
191
- from tensor_network_viz import PlotConfig
281
+ from tensor_network_viz import (
282
+ PlotConfig,
283
+ TensorNetworkDiagnosticsConfig,
284
+ TensorNetworkFocus,
285
+ )
192
286
 
193
287
  config = PlotConfig(
288
+ show_nodes=True,
194
289
  show_tensor_labels=True,
195
290
  show_index_labels=False,
196
291
  hover_labels=True,
197
292
  show_contraction_scheme=False,
293
+ contraction_scheme_cost_hover=False,
294
+ contraction_tensor_inspector=False,
295
+ diagnostics=TensorNetworkDiagnosticsConfig(
296
+ show_overlay=False,
297
+ include_hover=True,
298
+ ),
299
+ focus=TensorNetworkFocus(
300
+ kind="neighborhood",
301
+ center="A",
302
+ radius=1,
303
+ ),
198
304
  tensor_label_refinement="auto",
305
+ tensor_label_fontsize=None,
306
+ edge_label_fontsize=None,
199
307
  )
200
308
  ```
201
309
 
@@ -203,7 +311,10 @@ This is where you configure:
203
311
 
204
312
  - labels,
205
313
  - hover tooltips,
314
+ - diagnostics overlays and enriched hover payloads (`shape`, `dtype`, `bond dimension`, memory),
315
+ - reproducible subnetwork focus (`neighborhood` radius 1/2 or shortest `path` by tensor name),
206
316
  - contraction-scheme overlays,
317
+ - optional tensor/edge label font-size overrides,
207
318
  - styling,
208
319
  - layout iterations,
209
320
  - custom positions,
@@ -215,16 +326,31 @@ This is where you configure:
215
326
  Use `TensorElementsConfig` for tensor inspection behavior:
216
327
 
217
328
  ```python
218
- from tensor_network_viz import TensorElementsConfig
329
+ from tensor_network_viz import TensorAnalysisConfig, TensorElementsConfig
219
330
 
220
331
  config = TensorElementsConfig(
221
332
  mode="auto",
333
+ row_axes=None,
334
+ col_axes=None,
335
+ analysis=TensorAnalysisConfig(
336
+ slice_axis="phys",
337
+ slice_index=0,
338
+ reduce_axes=("bond",),
339
+ reduce_method="mean",
340
+ profile_axis="phys",
341
+ profile_method="norm",
342
+ ),
343
+ figsize=(7.2, 6.4),
222
344
  max_matrix_shape=(256, 256),
223
- histogram_bins=40,
224
- topk_count=8,
225
- robust_percentiles=(1.0, 99.0),
226
345
  shared_color_scale=False,
346
+ robust_percentiles=(1.0, 99.0),
227
347
  highlight_outliers=False,
348
+ outlier_zscore=3.5,
349
+ zero_threshold=1e-12,
350
+ log_magnitude_floor=1e-12,
351
+ histogram_bins=40,
352
+ histogram_max_samples=100_000,
353
+ topk_count=8,
228
354
  )
229
355
  ```
230
356
 
@@ -232,22 +358,37 @@ This is where you configure:
232
358
 
233
359
  - the active inspection mode,
234
360
  - row/column axis grouping for rank > 2 tensors,
361
+ - analysis selectors for `slice`, `reduce`, and `profiles`,
235
362
  - heatmap downsampling limits,
236
363
  - histogram sampling and bin count,
237
364
  - data-summary depth (`topk_count`),
238
- - optional robust/shared scaling and outlier overlays.
365
+ - heatmap/spectral reduction via `max_matrix_shape`,
366
+ - optional robust/shared scaling and outlier overlays,
367
+ - singular-value display floor and zero handling.
239
368
 
240
369
  If you want to start in a specific grouped view, pass `mode="real"`, `mode="imag"`,
241
- `mode="phase"`, `mode="log_magnitude"`, `mode="sparsity"`, `mode="nan_inf"`, `mode="sign"`, or
242
- `mode="signed_value"` directly in
243
- `TensorElementsConfig(...)`.
370
+ `mode="phase"`, `mode="log_magnitude"`, `mode="sparsity"`, `mode="nan_inf"`, `mode="sign"`,
371
+ `mode="signed_value"`, `mode="singular_values"`, `mode="eigen_real"`, `mode="eigen_imag"`,
372
+ `mode="slice"`, `mode="reduce"`, or `mode="profiles"` directly in `TensorElementsConfig(...)`.
373
+
374
+ For the analytical views, keep this mental model:
375
+
376
+ - `slice` fixes one axis at one index and removes that axis from the result.
377
+ - `reduce` collapses the checked axes with `mean` or `norm`, so you see the axes that were not
378
+ checked.
379
+ - `profiles` keeps one axis as a 1D curve and reduces the other surviving axes.
244
380
 
245
381
  ## Most Common Workflows
246
382
 
247
383
  ### Interactive figure with controls
248
384
 
249
385
  ```python
250
- from tensor_network_viz import PlotConfig, show_tensor_network
386
+ from tensor_network_viz import (
387
+ PlotConfig,
388
+ TensorNetworkDiagnosticsConfig,
389
+ TensorNetworkFocus,
390
+ show_tensor_network,
391
+ )
251
392
 
252
393
  fig, ax = show_tensor_network(
253
394
  network,
@@ -255,10 +396,17 @@ fig, ax = show_tensor_network(
255
396
  show_tensor_labels=False,
256
397
  show_index_labels=False,
257
398
  hover_labels=True,
399
+ diagnostics=TensorNetworkDiagnosticsConfig(show_overlay=True),
400
+ focus=TensorNetworkFocus(kind="neighborhood", center="A", radius=1),
258
401
  ),
259
402
  )
260
403
  ```
261
404
 
405
+ When the network exposes inspectable tensor values, clicking a visible tensor node opens the shared
406
+ auxiliary inspector directly. In playback-enabled traces, the same inspector can still follow the
407
+ current contraction result or stay pinned to a manually selected node until you click empty space
408
+ to clear the manual selection.
409
+
262
410
  ### Clean export with no embedded controls
263
411
 
264
412
  ```python
@@ -279,16 +427,71 @@ fig.savefig("network.png", bbox_inches="tight")
279
427
  ### Inspect tensor values
280
428
 
281
429
  ```python
282
- from tensor_network_viz import TensorElementsConfig, show_tensor_elements
430
+ from tensor_network_viz import TensorAnalysisConfig, TensorElementsConfig, show_tensor_elements
283
431
 
284
432
  fig, ax = show_tensor_elements(
285
433
  trace,
286
- config=TensorElementsConfig(mode="auto"),
434
+ config=TensorElementsConfig(
435
+ mode="profiles",
436
+ analysis=TensorAnalysisConfig(profile_axis="phys", profile_method="norm"),
437
+ ),
287
438
  show=False,
288
439
  )
289
440
  fig.savefig("tensor-elements.png", bbox_inches="tight")
290
441
  ```
291
442
 
443
+ ### Export a focused snapshot with diagnostics
444
+
445
+ ```python
446
+ from tensor_network_viz import (
447
+ PlotConfig,
448
+ TensorNetworkDiagnosticsConfig,
449
+ TensorNetworkFocus,
450
+ export_tensor_network_snapshot,
451
+ )
452
+
453
+ snapshot = export_tensor_network_snapshot(
454
+ network,
455
+ config=PlotConfig(
456
+ diagnostics=TensorNetworkDiagnosticsConfig(include_hover=True),
457
+ focus=TensorNetworkFocus(kind="path", endpoints=("A", "C")),
458
+ ),
459
+ )
460
+ payload = snapshot.to_dict()
461
+ ```
462
+
463
+ ### Compare tensors
464
+
465
+ ```python
466
+ from tensor_network_viz import (
467
+ TensorComparisonConfig,
468
+ TensorElementsConfig,
469
+ show_tensor_comparison,
470
+ )
471
+
472
+ fig, ax = show_tensor_comparison(
473
+ current_tensor,
474
+ reference_tensor,
475
+ config=TensorElementsConfig(mode="elements"),
476
+ comparison_config=TensorComparisonConfig(mode="abs_diff"),
477
+ show=False,
478
+ )
479
+ fig.savefig("tensor-comparison.png", bbox_inches="tight")
480
+ ```
481
+
482
+ ### Export a normalized snapshot
483
+
484
+ ```python
485
+ from tensor_network_viz import PlotConfig, export_tensor_network_snapshot
486
+
487
+ snapshot = export_tensor_network_snapshot(
488
+ network,
489
+ config=PlotConfig(),
490
+ view="2d",
491
+ )
492
+ payload = snapshot.to_dict()
493
+ ```
494
+
292
495
  ### Faster render for large graphs
293
496
 
294
497
  ```python
@@ -403,9 +606,9 @@ For fuller backend examples, see [docs/backends.md](docs/backends.md).
403
606
  | `show_tensor_labels` | Draw tensor names on nodes. |
404
607
  | `show_index_labels` | Draw index labels on bonds and dangling legs. |
405
608
  | `hover_labels` | Enable hover tooltips in interactive sessions. |
406
- | `show_contraction_scheme` | Draw contraction-step regions. |
407
- | `contraction_playback` | Start with playback controls enabled when controls are shown. |
408
- | `contraction_scheme_cost_hover` | Show contraction details in the playback panel. |
609
+ | `show_contraction_scheme` | Enable the dynamic contraction slider with real node shape/color changes. |
610
+ | `contraction_scheme_cost_hover` | Show contraction details in the slider panel. |
611
+ | `contraction_tensor_inspector` | Enable the auxiliary tensor inspector with direct node selection and comparison controls. |
409
612
  | `tensor_label_refinement` | `"auto"`, `"always"`, or `"never"` for the expensive label-fit pass. |
410
613
  | `layout_iterations` | Force-layout effort. |
411
614
  | `positions` | Supply custom node coordinates. |
@@ -444,6 +647,7 @@ python examples/tensor_elements_demo.py
444
647
  | Hover tooltips do nothing | Use an interactive Matplotlib backend; hover is not useful for PNG-only runs. |
445
648
  | Big graphs are slow | Set `tensor_label_refinement="never"`, reduce `layout_iterations`, or pass `positions`. |
446
649
  | `Unsupported tensor network engine` | Install the matching extra or pass the correct backend object. |
650
+ | `AxisConfigurationError` when passing `ax` | Use a 2D axis for `view="2d"`, a 3D axis for `view="3d"`, and only pass `ax` to `show_tensor_elements(...)` for a single tensor. |
447
651
  | `show_tensor_elements(...)` fails on TensorKrowch nodes | Materialize the node tensors first; shape-only nodes do not expose element values. |
448
652
  | `show_tensor_elements(...)` fails on manual `pair_tensor(...)` lists | Use an `EinsumTrace` with live tensors instead; manual trace steps only describe contractions. |
449
653
  | Blank / duplicate Jupyter figure | Assign `fig, ax = show_tensor_network(...)` instead of leaving the tuple as the last line. |
@@ -472,3 +676,12 @@ Run the project checks:
472
676
  ```powershell
473
677
  .\.venv\Scripts\python scripts\verify.py
474
678
  ```
679
+
680
+ Useful slices:
681
+
682
+ ```powershell
683
+ .\.venv\Scripts\python scripts\verify.py quality
684
+ .\.venv\Scripts\python scripts\verify.py tests
685
+ .\.venv\Scripts\python scripts\verify.py smoke
686
+ .\.venv\Scripts\python scripts\verify.py package
687
+ ```