Trajectree 0.0.0__py3-none-any.whl → 0.0.1__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.
Files changed (122) hide show
  1. trajectree/__init__.py +3 -0
  2. trajectree/fock_optics/devices.py +1 -1
  3. trajectree/fock_optics/light_sources.py +2 -2
  4. trajectree/fock_optics/measurement.py +3 -3
  5. trajectree/fock_optics/utils.py +6 -6
  6. trajectree/quimb/docs/_pygments/_pygments_dark.py +118 -0
  7. trajectree/quimb/docs/_pygments/_pygments_light.py +118 -0
  8. trajectree/quimb/docs/conf.py +158 -0
  9. trajectree/quimb/docs/examples/ex_mpi_expm_evo.py +62 -0
  10. trajectree/quimb/quimb/__init__.py +507 -0
  11. trajectree/quimb/quimb/calc.py +1491 -0
  12. trajectree/quimb/quimb/core.py +2279 -0
  13. trajectree/quimb/quimb/evo.py +712 -0
  14. trajectree/quimb/quimb/experimental/__init__.py +0 -0
  15. trajectree/quimb/quimb/experimental/autojittn.py +129 -0
  16. trajectree/quimb/quimb/experimental/belief_propagation/__init__.py +109 -0
  17. trajectree/quimb/quimb/experimental/belief_propagation/bp_common.py +397 -0
  18. trajectree/quimb/quimb/experimental/belief_propagation/d1bp.py +316 -0
  19. trajectree/quimb/quimb/experimental/belief_propagation/d2bp.py +653 -0
  20. trajectree/quimb/quimb/experimental/belief_propagation/hd1bp.py +571 -0
  21. trajectree/quimb/quimb/experimental/belief_propagation/hv1bp.py +775 -0
  22. trajectree/quimb/quimb/experimental/belief_propagation/l1bp.py +316 -0
  23. trajectree/quimb/quimb/experimental/belief_propagation/l2bp.py +537 -0
  24. trajectree/quimb/quimb/experimental/belief_propagation/regions.py +194 -0
  25. trajectree/quimb/quimb/experimental/cluster_update.py +286 -0
  26. trajectree/quimb/quimb/experimental/merabuilder.py +865 -0
  27. trajectree/quimb/quimb/experimental/operatorbuilder/__init__.py +15 -0
  28. trajectree/quimb/quimb/experimental/operatorbuilder/operatorbuilder.py +1631 -0
  29. trajectree/quimb/quimb/experimental/schematic.py +7 -0
  30. trajectree/quimb/quimb/experimental/tn_marginals.py +130 -0
  31. trajectree/quimb/quimb/experimental/tnvmc.py +1483 -0
  32. trajectree/quimb/quimb/gates.py +36 -0
  33. trajectree/quimb/quimb/gen/__init__.py +2 -0
  34. trajectree/quimb/quimb/gen/operators.py +1167 -0
  35. trajectree/quimb/quimb/gen/rand.py +713 -0
  36. trajectree/quimb/quimb/gen/states.py +479 -0
  37. trajectree/quimb/quimb/linalg/__init__.py +6 -0
  38. trajectree/quimb/quimb/linalg/approx_spectral.py +1109 -0
  39. trajectree/quimb/quimb/linalg/autoblock.py +258 -0
  40. trajectree/quimb/quimb/linalg/base_linalg.py +719 -0
  41. trajectree/quimb/quimb/linalg/mpi_launcher.py +397 -0
  42. trajectree/quimb/quimb/linalg/numpy_linalg.py +244 -0
  43. trajectree/quimb/quimb/linalg/rand_linalg.py +514 -0
  44. trajectree/quimb/quimb/linalg/scipy_linalg.py +293 -0
  45. trajectree/quimb/quimb/linalg/slepc_linalg.py +892 -0
  46. trajectree/quimb/quimb/schematic.py +1518 -0
  47. trajectree/quimb/quimb/tensor/__init__.py +401 -0
  48. trajectree/quimb/quimb/tensor/array_ops.py +610 -0
  49. trajectree/quimb/quimb/tensor/circuit.py +4824 -0
  50. trajectree/quimb/quimb/tensor/circuit_gen.py +411 -0
  51. trajectree/quimb/quimb/tensor/contraction.py +336 -0
  52. trajectree/quimb/quimb/tensor/decomp.py +1255 -0
  53. trajectree/quimb/quimb/tensor/drawing.py +1646 -0
  54. trajectree/quimb/quimb/tensor/fitting.py +385 -0
  55. trajectree/quimb/quimb/tensor/geometry.py +583 -0
  56. trajectree/quimb/quimb/tensor/interface.py +114 -0
  57. trajectree/quimb/quimb/tensor/networking.py +1058 -0
  58. trajectree/quimb/quimb/tensor/optimize.py +1818 -0
  59. trajectree/quimb/quimb/tensor/tensor_1d.py +4778 -0
  60. trajectree/quimb/quimb/tensor/tensor_1d_compress.py +1854 -0
  61. trajectree/quimb/quimb/tensor/tensor_1d_tebd.py +662 -0
  62. trajectree/quimb/quimb/tensor/tensor_2d.py +5954 -0
  63. trajectree/quimb/quimb/tensor/tensor_2d_compress.py +96 -0
  64. trajectree/quimb/quimb/tensor/tensor_2d_tebd.py +1230 -0
  65. trajectree/quimb/quimb/tensor/tensor_3d.py +2869 -0
  66. trajectree/quimb/quimb/tensor/tensor_3d_tebd.py +46 -0
  67. trajectree/quimb/quimb/tensor/tensor_approx_spectral.py +60 -0
  68. trajectree/quimb/quimb/tensor/tensor_arbgeom.py +3237 -0
  69. trajectree/quimb/quimb/tensor/tensor_arbgeom_compress.py +565 -0
  70. trajectree/quimb/quimb/tensor/tensor_arbgeom_tebd.py +1138 -0
  71. trajectree/quimb/quimb/tensor/tensor_builder.py +5411 -0
  72. trajectree/quimb/quimb/tensor/tensor_core.py +11179 -0
  73. trajectree/quimb/quimb/tensor/tensor_dmrg.py +1472 -0
  74. trajectree/quimb/quimb/tensor/tensor_mera.py +204 -0
  75. trajectree/quimb/quimb/utils.py +892 -0
  76. trajectree/quimb/tests/__init__.py +0 -0
  77. trajectree/quimb/tests/test_accel.py +501 -0
  78. trajectree/quimb/tests/test_calc.py +788 -0
  79. trajectree/quimb/tests/test_core.py +847 -0
  80. trajectree/quimb/tests/test_evo.py +565 -0
  81. trajectree/quimb/tests/test_gen/__init__.py +0 -0
  82. trajectree/quimb/tests/test_gen/test_operators.py +361 -0
  83. trajectree/quimb/tests/test_gen/test_rand.py +296 -0
  84. trajectree/quimb/tests/test_gen/test_states.py +261 -0
  85. trajectree/quimb/tests/test_linalg/__init__.py +0 -0
  86. trajectree/quimb/tests/test_linalg/test_approx_spectral.py +368 -0
  87. trajectree/quimb/tests/test_linalg/test_base_linalg.py +351 -0
  88. trajectree/quimb/tests/test_linalg/test_mpi_linalg.py +127 -0
  89. trajectree/quimb/tests/test_linalg/test_numpy_linalg.py +84 -0
  90. trajectree/quimb/tests/test_linalg/test_rand_linalg.py +134 -0
  91. trajectree/quimb/tests/test_linalg/test_slepc_linalg.py +283 -0
  92. trajectree/quimb/tests/test_tensor/__init__.py +0 -0
  93. trajectree/quimb/tests/test_tensor/test_belief_propagation/__init__.py +0 -0
  94. trajectree/quimb/tests/test_tensor/test_belief_propagation/test_d1bp.py +39 -0
  95. trajectree/quimb/tests/test_tensor/test_belief_propagation/test_d2bp.py +67 -0
  96. trajectree/quimb/tests/test_tensor/test_belief_propagation/test_hd1bp.py +64 -0
  97. trajectree/quimb/tests/test_tensor/test_belief_propagation/test_hv1bp.py +51 -0
  98. trajectree/quimb/tests/test_tensor/test_belief_propagation/test_l1bp.py +142 -0
  99. trajectree/quimb/tests/test_tensor/test_belief_propagation/test_l2bp.py +101 -0
  100. trajectree/quimb/tests/test_tensor/test_circuit.py +816 -0
  101. trajectree/quimb/tests/test_tensor/test_contract.py +67 -0
  102. trajectree/quimb/tests/test_tensor/test_decomp.py +40 -0
  103. trajectree/quimb/tests/test_tensor/test_mera.py +52 -0
  104. trajectree/quimb/tests/test_tensor/test_optimizers.py +488 -0
  105. trajectree/quimb/tests/test_tensor/test_tensor_1d.py +1171 -0
  106. trajectree/quimb/tests/test_tensor/test_tensor_2d.py +606 -0
  107. trajectree/quimb/tests/test_tensor/test_tensor_2d_tebd.py +144 -0
  108. trajectree/quimb/tests/test_tensor/test_tensor_3d.py +123 -0
  109. trajectree/quimb/tests/test_tensor/test_tensor_arbgeom.py +226 -0
  110. trajectree/quimb/tests/test_tensor/test_tensor_builder.py +441 -0
  111. trajectree/quimb/tests/test_tensor/test_tensor_core.py +2066 -0
  112. trajectree/quimb/tests/test_tensor/test_tensor_dmrg.py +388 -0
  113. trajectree/quimb/tests/test_tensor/test_tensor_spectral_approx.py +63 -0
  114. trajectree/quimb/tests/test_tensor/test_tensor_tebd.py +270 -0
  115. trajectree/quimb/tests/test_utils.py +85 -0
  116. trajectree/trajectory.py +2 -2
  117. {trajectree-0.0.0.dist-info → trajectree-0.0.1.dist-info}/METADATA +2 -2
  118. trajectree-0.0.1.dist-info/RECORD +126 -0
  119. trajectree-0.0.0.dist-info/RECORD +0 -16
  120. {trajectree-0.0.0.dist-info → trajectree-0.0.1.dist-info}/WHEEL +0 -0
  121. {trajectree-0.0.0.dist-info → trajectree-0.0.1.dist-info}/licenses/LICENSE +0 -0
  122. {trajectree-0.0.0.dist-info → trajectree-0.0.1.dist-info}/top_level.txt +0 -0
trajectree/__init__.py CHANGED
@@ -0,0 +1,3 @@
1
+ import sys
2
+ import os
3
+ sys.path.append(os.path.abspath(__file__).replace('__init__.py', 'quimb'))
@@ -3,7 +3,7 @@ from scipy.linalg import expm
3
3
  import numpy as np
4
4
  from numpy import kron
5
5
 
6
- from quimb.tensor import MatrixProductOperator as mpo #type: ignore
6
+ from ..quimb.quimb.tensor import MatrixProductOperator as mpo #type: ignore
7
7
 
8
8
  import qutip as qt
9
9
 
@@ -8,8 +8,8 @@ import numpy as np
8
8
  from numpy.linalg import matrix_power
9
9
  from numpy import kron, sqrt
10
10
 
11
- from quimb.tensor.tensor_arbgeom import tensor_network_apply_op_vec #type: ignore
12
- from quimb.tensor.tensor_1d_compress import enforce_1d_like #type: ignore
11
+ from ..quimb.quimb.tensor.tensor_arbgeom import tensor_network_apply_op_vec #type: ignore
12
+ from ..quimb.quimb.tensor.tensor_1d_compress import enforce_1d_like #type: ignore
13
13
 
14
14
  import qutip as qt
15
15
  from math import factorial
@@ -9,9 +9,9 @@ import numpy as np
9
9
  from numpy.linalg import matrix_power
10
10
  from numpy import sqrt
11
11
 
12
- from quimb.tensor import MatrixProductOperator as mpo #type: ignore
13
- from quimb.tensor.tensor_arbgeom import tensor_network_apply_op_vec #type: ignore
14
- from quimb.tensor.tensor_1d_compress import enforce_1d_like #type: ignore
12
+ from ..quimb.quimb.tensor import MatrixProductOperator as mpo #type: ignore
13
+ from ..quimb.quimb.tensor.tensor_arbgeom import tensor_network_apply_op_vec #type: ignore
14
+ from ..quimb.quimb.tensor.tensor_1d_compress import enforce_1d_like #type: ignore
15
15
 
16
16
  import qutip as qt
17
17
  from math import factorial
@@ -1,12 +1,12 @@
1
1
  import numpy as np
2
2
  from numpy import sqrt
3
3
 
4
- from quimb.tensor import MatrixProductState as mps #type: ignore
5
- from quimb.tensor import MatrixProductOperator as mpo #type: ignore
6
- from quimb.tensor.tensor_arbgeom import tensor_network_apply_op_vec #type: ignore
7
- from quimb.tensor.tensor_core import new_bond #type: ignore
8
- from quimb.tensor.tensor_1d_compress import enforce_1d_like #type: ignore
9
- from quimb.tensor.tensor_1d import TensorNetwork1DOperator #type: ignore
4
+ from ..quimb.quimb.tensor import MatrixProductState as mps #type: ignore
5
+ from ..quimb.quimb.tensor import MatrixProductOperator as mpo #type: ignore
6
+ from ..quimb.quimb.tensor.tensor_arbgeom import tensor_network_apply_op_vec #type: ignore
7
+ from ..quimb.quimb.tensor.tensor_core import new_bond #type: ignore
8
+ from ..quimb.quimb.tensor.tensor_1d_compress import enforce_1d_like #type: ignore
9
+ from ..quimb.quimb.tensor.tensor_1d import TensorNetwork1DOperator #type: ignore
10
10
 
11
11
  import qutip as qt
12
12
  import re
@@ -0,0 +1,118 @@
1
+ # -*- coding: utf-8 -*-
2
+ """
3
+ Pygments version of the sublime Mariana theme.
4
+
5
+ Pygments template by Jan T. Sott (https://github.com/idleberg)
6
+ """
7
+
8
+ from pygments.style import Style
9
+ from pygments.token import Keyword, Name, Comment, String, Error, Text, \
10
+ Number, Operator, Generic, Whitespace, Punctuation, Other, Literal
11
+
12
+
13
+ BACKGROUND = "#1a1c1e"
14
+ CURRENT_LINE = "#4e5a65"
15
+ SELECTION = "#343d46"
16
+ FOREGROUND = "#d8dee9"
17
+ COMMENT = "#5a6272"
18
+ RED = "#ec5f66"
19
+ ORANGE = "#f9ae58"
20
+ YELLOW = "#fac761"
21
+ GREEN = "#99c794"
22
+ AQUA = "#70c2bb"
23
+ BLUE = "#6699cc"
24
+ PURPLE = "#c695c6"
25
+
26
+
27
+ class MarianaDark(Style):
28
+
29
+ default_style = ''
30
+
31
+ background_color = BACKGROUND
32
+ highlight_color = SELECTION
33
+
34
+ background_color = BACKGROUND
35
+ highlight_color = SELECTION
36
+
37
+ styles = {
38
+ # No corresponding class for the following:
39
+ Text: FOREGROUND, # class: ''
40
+ Whitespace: "", # class: 'w'
41
+ Error: RED, # class: 'err'
42
+ Other: "", # class 'x'
43
+
44
+ Comment: COMMENT, # class: 'c'
45
+ Comment.Multiline: "", # class: 'cm'
46
+ Comment.Preproc: "", # class: 'cp'
47
+ Comment.Single: "", # class: 'c1'
48
+ Comment.Special: "", # class: 'cs'
49
+
50
+ Keyword: PURPLE, # class: 'k'
51
+ Keyword.Constant: RED, # class: 'kc'
52
+ Keyword.Declaration: "", # class: 'kd'
53
+ Keyword.Namespace: PURPLE, # class: 'kn'
54
+ Keyword.Pseudo: RED, # class: 'kp'
55
+ Keyword.Reserved: "", # class: 'kr'
56
+ Keyword.Type: YELLOW, # class: 'kt'
57
+
58
+ Operator: RED, # class: 'o'
59
+ Operator.Word: "", # class: 'ow' - like keywords
60
+
61
+ Punctuation: AQUA, # class: 'p'
62
+
63
+ Name: FOREGROUND, # class: 'n'
64
+ Name.Attribute: BLUE, # class: 'na' - to be revised
65
+ Name.Builtin: BLUE, # class: 'nb'
66
+ Name.Builtin.Pseudo: RED, # class: 'bp'
67
+ Name.Class: ORANGE, # class: 'nc' - to be revised
68
+ Name.Constant: RED, # class: 'no' - to be revised
69
+ Name.Decorator: AQUA, # class: 'nd' - to be revised
70
+ Name.Entity: BLUE, # class: 'ni'
71
+ Name.Exception: RED, # class: 'ne'
72
+ Name.Function: AQUA, # class: 'nf'
73
+ Name.Function.Magic: BLUE, # class: 'nf'
74
+ Name.Property: BLUE, # class: 'py'
75
+ Name.Label: BLUE, # class: 'nl'
76
+ Name.Namespace: BLUE, # class: 'nn' - to be revised
77
+ Name.Other: BLUE, # class: 'nx'
78
+ Name.Tag: AQUA, # class: 'nt' - like a keyword
79
+ Name.Variable: RED, # class: 'nv' - to be revised
80
+ Name.Variable.Class: "", # class: 'vc' - to be revised
81
+ Name.Variable.Global: "", # class: 'vg' - to be revised
82
+ Name.Variable.Instance: "", # class: 'vi' - to be revised
83
+
84
+ Number: ORANGE, # class: 'm'
85
+ Number.Float: "", # class: 'mf'
86
+ Number.Hex: "", # class: 'mh'
87
+ Number.Integer: "", # class: 'mi'
88
+ Number.Integer.Long: "", # class: 'il'
89
+ Number.Oct: "", # class: 'mo'
90
+
91
+ Literal: ORANGE, # class: 'l'
92
+ Literal.Date: GREEN, # class: 'ld'
93
+
94
+ String: GREEN, # class: 's'
95
+ String.Backtick: "", # class: 'sb'
96
+ String.Char: FOREGROUND, # class: 'sc'
97
+ String.Doc: COMMENT, # class: 'sd' - like a comment
98
+ String.Double: "", # class: 's2'
99
+ String.Escape: ORANGE, # class: 'se'
100
+ String.Heredoc: "", # class: 'sh'
101
+ String.Interpol: ORANGE, # class: 'si'
102
+ String.Other: "", # class: 'sx'
103
+ String.Regex: "", # class: 'sr'
104
+ String.Single: "", # class: 's1'
105
+ String.Symbol: "", # class: 'ss'
106
+
107
+ Generic: "", # class: 'g'
108
+ Generic.Deleted: RED, # class: 'gd',
109
+ Generic.Emph: "italic", # class: 'ge'
110
+ Generic.Error: "", # class: 'gr'
111
+ Generic.Heading: "bold " + FOREGROUND, # class: 'gh'
112
+ Generic.Inserted: GREEN, # class: 'gi'
113
+ Generic.Output: "", # class: 'go'
114
+ Generic.Prompt: "bold " + COMMENT, # class: 'gp'
115
+ Generic.Strong: "bold", # class: 'gs'
116
+ Generic.Subheading: "bold " + AQUA, # class: 'gu'
117
+ Generic.Traceback: "", # class: 'gt'
118
+ }
@@ -0,0 +1,118 @@
1
+ # -*- coding: utf-8 -*-
2
+ """
3
+ Pygments (light) version of the sublime Mariana theme.
4
+
5
+ Pygments template by Jan T. Sott (https://github.com/idleberg)
6
+ """
7
+
8
+ from pygments.style import Style
9
+ from pygments.token import Keyword, Name, Comment, String, Error, Text, \
10
+ Number, Operator, Generic, Whitespace, Punctuation, Other, Literal
11
+
12
+
13
+ BACKGROUND = "#f8f9fb"
14
+ CURRENT_LINE = "#b7c0c8"
15
+ SELECTION = "#d0d6dc"
16
+ FOREGROUND = "#161c27"
17
+ COMMENT = "#8d95a5"
18
+ RED = "#e7323b"
19
+ ORANGE = "#f79626"
20
+ YELLOW = "#f9b52f"
21
+ GREEN = "#70b069"
22
+ AQUA = "#3d8f88"
23
+ BLUE = "#407fbf"
24
+ PURPLE = "#b474b4"
25
+
26
+
27
+ class MarianaLight(Style):
28
+
29
+ default_style = ''
30
+
31
+ background_color = BACKGROUND
32
+ highlight_color = SELECTION
33
+
34
+ background_color = BACKGROUND
35
+ highlight_color = SELECTION
36
+
37
+ styles = {
38
+ # No corresponding class for the following:
39
+ Text: FOREGROUND, # class: ''
40
+ Whitespace: "", # class: 'w'
41
+ Error: RED, # class: 'err'
42
+ Other: "", # class 'x'
43
+
44
+ Comment: COMMENT, # class: 'c'
45
+ Comment.Multiline: "", # class: 'cm'
46
+ Comment.Preproc: "", # class: 'cp'
47
+ Comment.Single: "", # class: 'c1'
48
+ Comment.Special: "", # class: 'cs'
49
+
50
+ Keyword: PURPLE, # class: 'k'
51
+ Keyword.Constant: RED, # class: 'kc'
52
+ Keyword.Declaration: "", # class: 'kd'
53
+ Keyword.Namespace: PURPLE, # class: 'kn'
54
+ Keyword.Pseudo: RED, # class: 'kp'
55
+ Keyword.Reserved: "", # class: 'kr'
56
+ Keyword.Type: YELLOW, # class: 'kt'
57
+
58
+ Operator: RED, # class: 'o'
59
+ Operator.Word: "", # class: 'ow' - like keywords
60
+
61
+ Punctuation: AQUA, # class: 'p'
62
+
63
+ Name: FOREGROUND, # class: 'n'
64
+ Name.Attribute: BLUE, # class: 'na' - to be revised
65
+ Name.Builtin: BLUE, # class: 'nb'
66
+ Name.Builtin.Pseudo: RED, # class: 'bp'
67
+ Name.Class: ORANGE, # class: 'nc' - to be revised
68
+ Name.Constant: RED, # class: 'no' - to be revised
69
+ Name.Decorator: AQUA, # class: 'nd' - to be revised
70
+ Name.Entity: BLUE, # class: 'ni'
71
+ Name.Exception: RED, # class: 'ne'
72
+ Name.Function: AQUA, # class: 'nf'
73
+ Name.Function.Magic: BLUE, # class: 'nf'
74
+ Name.Property: BLUE, # class: 'py'
75
+ Name.Label: BLUE, # class: 'nl'
76
+ Name.Namespace: BLUE, # class: 'nn' - to be revised
77
+ Name.Other: BLUE, # class: 'nx'
78
+ Name.Tag: AQUA, # class: 'nt' - like a keyword
79
+ Name.Variable: RED, # class: 'nv' - to be revised
80
+ Name.Variable.Class: "", # class: 'vc' - to be revised
81
+ Name.Variable.Global: "", # class: 'vg' - to be revised
82
+ Name.Variable.Instance: "", # class: 'vi' - to be revised
83
+
84
+ Number: ORANGE, # class: 'm'
85
+ Number.Float: "", # class: 'mf'
86
+ Number.Hex: "", # class: 'mh'
87
+ Number.Integer: "", # class: 'mi'
88
+ Number.Integer.Long: "", # class: 'il'
89
+ Number.Oct: "", # class: 'mo'
90
+
91
+ Literal: ORANGE, # class: 'l'
92
+ Literal.Date: GREEN, # class: 'ld'
93
+
94
+ String: GREEN, # class: 's'
95
+ String.Backtick: "", # class: 'sb'
96
+ String.Char: FOREGROUND, # class: 'sc'
97
+ String.Doc: COMMENT, # class: 'sd' - like a comment
98
+ String.Double: "", # class: 's2'
99
+ String.Escape: ORANGE, # class: 'se'
100
+ String.Heredoc: "", # class: 'sh'
101
+ String.Interpol: ORANGE, # class: 'si'
102
+ String.Other: "", # class: 'sx'
103
+ String.Regex: "", # class: 'sr'
104
+ String.Single: "", # class: 's1'
105
+ String.Symbol: "", # class: 'ss'
106
+
107
+ Generic: "", # class: 'g'
108
+ Generic.Deleted: RED, # class: 'gd',
109
+ Generic.Emph: "italic", # class: 'ge'
110
+ Generic.Error: "", # class: 'gr'
111
+ Generic.Heading: "bold " + FOREGROUND, # class: 'gh'
112
+ Generic.Inserted: GREEN, # class: 'gi'
113
+ Generic.Output: "", # class: 'go'
114
+ Generic.Prompt: "bold " + COMMENT, # class: 'gp'
115
+ Generic.Strong: "bold", # class: 'gs'
116
+ Generic.Subheading: "bold " + AQUA, # class: 'gu'
117
+ Generic.Traceback: "", # class: 'gt'
118
+ }
@@ -0,0 +1,158 @@
1
+ # Configuration file for the Sphinx documentation builder.
2
+ #
3
+ # For the full list of built-in configuration values, see the documentation:
4
+ # https://www.sphinx-doc.org/en/master/usage/configuration.html
5
+
6
+ import os
7
+ import sys
8
+ sys.path.append(os.path.abspath("./_pygments"))
9
+
10
+ # -- Project information -----------------------------------------------------
11
+ # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
12
+
13
+ project = 'quimb'
14
+ copyright = '2015-2024, Johnnie Gray'
15
+ author = 'Johnnie Gray'
16
+
17
+ # The full version, including alpha/beta/rc tags
18
+ try:
19
+ from quimb import __version__
20
+ release = __version__
21
+ except ImportError:
22
+ try:
23
+ from importlib.metadata import version as _version
24
+ release = _version('quimb')
25
+ except ImportError:
26
+ release = '0.0.0+unknown'
27
+
28
+ version = '.'.join(release.split('.')[:2])
29
+
30
+ # -- General configuration ---------------------------------------------------
31
+ # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
32
+
33
+ extensions = [
34
+ 'sphinx.ext.intersphinx',
35
+ 'sphinx.ext.extlinks',
36
+ 'sphinx.ext.napoleon',
37
+ 'sphinx.ext.linkcode',
38
+ 'myst_nb',
39
+ "sphinx_design",
40
+ 'sphinx_copybutton',
41
+ 'autoapi.extension',
42
+ ]
43
+
44
+ # msyt_nb configuration
45
+ nb_execution_mode = "off"
46
+ myst_heading_anchors = 4
47
+ myst_enable_extensions = [
48
+ "amsmath",
49
+ "colon_fence",
50
+ "deflist",
51
+ "dollarmath",
52
+ "html_image",
53
+ ]
54
+
55
+
56
+ # sphinx-autoapi
57
+ autoapi_dirs = ['../quimb']
58
+
59
+ extlinks = {
60
+ 'issue': ('https://github.com/jcmgray/quimb/issues/%s', 'GH %s'),
61
+ 'pull': ('https://github.com/jcmgray/quimb/pull/%s', 'PR %s'),
62
+ }
63
+ intersphinx_mapping = {
64
+ 'python': ('https://docs.python.org/3/', None),
65
+ 'numpy': ('https://numpy.org/doc/stable/', None),
66
+ 'scipy': ('https://docs.scipy.org/doc/scipy/', None),
67
+ 'cotengra': ('https://cotengra.readthedocs.io/en/latest/', None),
68
+ 'autoray': ('https://autoray.readthedocs.io/en/latest/', None),
69
+ }
70
+
71
+ # Add any paths that contain templates here, relative to this directory.
72
+ templates_path = ['_templates']
73
+
74
+ # List of patterns, relative to source directory, that match files and
75
+ # directories to ignore when looking for source files.
76
+ # This pattern also affects html_static_path and html_extra_path.
77
+ exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', '**.ipynb_checkpoints']
78
+
79
+ # -- Options for HTML output -------------------------------------------------
80
+ # https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
81
+
82
+ html_theme = 'furo'
83
+ html_theme_options = {
84
+ "sidebar_hide_name": True,
85
+ "light_css_variables": {
86
+ # "color-brand-primary": "hsl(45, 80%, 45%)",
87
+ "color-brand-primary": "hsl(210, 50%, 50%)",
88
+ "color-brand-content": "hsl(210, 50%, 50%)",
89
+ },
90
+ "dark_css_variables": {
91
+ "color-brand-primary": "hsl(210, 50%, 60%)",
92
+ "color-brand-content": "hsl(210, 50%, 60%)",
93
+ },
94
+ "light_logo": "quimb_logo_title.png",
95
+ "dark_logo": "quimb_logo_title.png",
96
+ }
97
+
98
+ pygments_style = '_pygments_light.MarianaLight'
99
+ pygments_dark_style = "_pygments_dark.MarianaDark"
100
+
101
+ html_static_path = ['_static']
102
+ html_css_files = ["my-styles.css"]
103
+ html_favicon = "_static/quimb.ico"
104
+
105
+
106
+ def linkcode_resolve(domain, info):
107
+ """
108
+ Determine the URL corresponding to Python object
109
+ """
110
+ import quimb
111
+ import inspect
112
+
113
+ if domain != "py":
114
+ return None
115
+
116
+ modname = info["module"]
117
+ fullname = info["fullname"]
118
+
119
+ submod = sys.modules.get(modname)
120
+ if submod is None:
121
+ return None
122
+
123
+ obj = submod
124
+ for part in fullname.split("."):
125
+ try:
126
+ obj = getattr(obj, part)
127
+ except AttributeError:
128
+ return None
129
+
130
+ try:
131
+ fn = inspect.getsourcefile(inspect.unwrap(obj))
132
+ except TypeError:
133
+ fn = None
134
+ if not fn:
135
+ return None
136
+
137
+ try:
138
+ source, lineno = inspect.getsourcelines(obj)
139
+ except OSError:
140
+ lineno = None
141
+
142
+ if lineno:
143
+ linespec = f"#L{lineno}-L{lineno + len(source) - 1}"
144
+ else:
145
+ linespec = ""
146
+
147
+ fn = os.path.relpath(fn, start=os.path.dirname(quimb.__file__))
148
+
149
+ if "+" in quimb.__version__:
150
+ return (
151
+ f"https://github.com/jcmgray/quimb/blob/"
152
+ f"main/quimb/{fn}{linespec}"
153
+ )
154
+ else:
155
+ return (
156
+ f"https://github.com/jcmgray/quimb/blob/"
157
+ f"v{quimb.__version__}/quimb/{fn}{linespec}"
158
+ )
@@ -0,0 +1,62 @@
1
+ """This script illustrates how quimb's various MPI modes work.
2
+
3
+ It can be run as:
4
+
5
+ python ex_mpi_modes_expm_evo.py
6
+ quimb-mpi-python ex_mpi_modes_expm_evo.py
7
+ quimb-mpi-python --syncro ex_mpi_modes_expm_evo.py
8
+
9
+ And will display slightly different output for each that explains the
10
+ three modes.
11
+ """
12
+ import quimb as qu
13
+ from mpi4py import MPI
14
+
15
+ # Get some MPI information
16
+ comm = MPI.COMM_WORLD
17
+ rank, size = comm.Get_rank(), comm.Get_size()
18
+ print(f"I am worker {rank} of total {size} running main script...")
19
+
20
+
21
+ # setup a verbose version of the ham_heis constructor, and make it Lazy
22
+ n = 18
23
+ shape = (2**n, 2**n)
24
+
25
+ # this makes the function print some information when called
26
+ # - in order to be pickled is has to be located in the main package
27
+ ham_heis_verbose = qu.utils.Verbosify(qu.ham_heis,
28
+ highlight='ownership', mpi=True)
29
+
30
+ H = qu.Lazy(ham_heis_verbose, n=n, sparse=True, shape=shape)
31
+
32
+ # random initial state
33
+ # - must make sure all processes have the same seed to be pure
34
+ psi0 = qu.rand_ket(2**n, seed=42)
35
+
36
+ # evolve the system, processes split 'hard' work (slepc computations)
37
+ # - should see each worker gets given a different ownership rows
38
+ # - but all end up with the results.
39
+ evo = qu.Evolution(psi0, H, method='expm', expm_backend='slepc')
40
+ evo.update_to(5)
41
+
42
+
43
+ print(f"{rank}: I have final state norm {qu.expec(evo.pt, evo.pt)}")
44
+
45
+ # Now lets demonstrate using the MPI pool construct
46
+ pool = qu.get_mpi_pool()
47
+
48
+ dims = [2] * n
49
+ bsz = 5
50
+ logneg_subsys_verbose = qu.utils.Verbosify(qu.logneg_subsys,
51
+ highlight='sysb', mpi=True)
52
+
53
+ # each process only computes its own fraction of these
54
+ # - should see each process calls logneg with different ``sysb``.
55
+ fs = [pool.submit(logneg_subsys_verbose, evo.pt, dims=dims,
56
+ sysa=range(0, bsz), sysb=range(i, i + bsz))
57
+ for i in range(bsz, n - bsz)]
58
+
59
+ # but then the results are comminucated to everyone
60
+ rs = [f.result() for f in fs]
61
+
62
+ print(f"{rank}: I have logneg results: {rs}")