pyqrackising 9.5.4__tar.gz → 9.5.5__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.
Potentially problematic release.
This version of pyqrackising might be problematic. Click here for more details.
- {pyqrackising-9.5.4/pyqrackising.egg-info → pyqrackising-9.5.5}/PKG-INFO +1 -1
- {pyqrackising-9.5.4 → pyqrackising-9.5.5}/pyproject.toml +1 -1
- {pyqrackising-9.5.4 → pyqrackising-9.5.5}/pyqrackising/maxcut_tfim_util.py +2 -2
- {pyqrackising-9.5.4 → pyqrackising-9.5.5}/pyqrackising/otoc.py +24 -20
- {pyqrackising-9.5.4 → pyqrackising-9.5.5/pyqrackising.egg-info}/PKG-INFO +1 -1
- {pyqrackising-9.5.4 → pyqrackising-9.5.5}/setup.py +1 -1
- {pyqrackising-9.5.4 → pyqrackising-9.5.5}/LICENSE.md +0 -0
- {pyqrackising-9.5.4 → pyqrackising-9.5.5}/MANIFEST.in +0 -0
- {pyqrackising-9.5.4 → pyqrackising-9.5.5}/README.md +0 -0
- {pyqrackising-9.5.4 → pyqrackising-9.5.5}/pyqrackising/__init__.py +0 -0
- {pyqrackising-9.5.4 → pyqrackising-9.5.5}/pyqrackising/convert_tensor_network_to_tsp.py +0 -0
- {pyqrackising-9.5.4 → pyqrackising-9.5.5}/pyqrackising/generate_tfim_samples.py +0 -0
- {pyqrackising-9.5.4 → pyqrackising-9.5.5}/pyqrackising/kernels.cl +0 -0
- {pyqrackising-9.5.4 → pyqrackising-9.5.5}/pyqrackising/maxcut_tfim.py +0 -0
- {pyqrackising-9.5.4 → pyqrackising-9.5.5}/pyqrackising/maxcut_tfim_sparse.py +0 -0
- {pyqrackising-9.5.4 → pyqrackising-9.5.5}/pyqrackising/maxcut_tfim_streaming.py +0 -0
- {pyqrackising-9.5.4 → pyqrackising-9.5.5}/pyqrackising/spin_glass_solver.py +0 -0
- {pyqrackising-9.5.4 → pyqrackising-9.5.5}/pyqrackising/spin_glass_solver_sparse.py +0 -0
- {pyqrackising-9.5.4 → pyqrackising-9.5.5}/pyqrackising/spin_glass_solver_streaming.py +0 -0
- {pyqrackising-9.5.4 → pyqrackising-9.5.5}/pyqrackising/tfim_magnetization.py +0 -0
- {pyqrackising-9.5.4 → pyqrackising-9.5.5}/pyqrackising/tfim_square_magnetization.py +0 -0
- {pyqrackising-9.5.4 → pyqrackising-9.5.5}/pyqrackising/tsp.py +0 -0
- {pyqrackising-9.5.4 → pyqrackising-9.5.5}/pyqrackising/tsp_maxcut.py +0 -0
- {pyqrackising-9.5.4 → pyqrackising-9.5.5}/pyqrackising.egg-info/SOURCES.txt +0 -0
- {pyqrackising-9.5.4 → pyqrackising-9.5.5}/pyqrackising.egg-info/dependency_links.txt +0 -0
- {pyqrackising-9.5.4 → pyqrackising-9.5.5}/pyqrackising.egg-info/not-zip-safe +0 -0
- {pyqrackising-9.5.4 → pyqrackising-9.5.5}/pyqrackising.egg-info/top_level.txt +0 -0
- {pyqrackising-9.5.4 → pyqrackising-9.5.5}/setup.cfg +0 -0
|
@@ -10,7 +10,7 @@ build-backend = "setuptools.build_meta"
|
|
|
10
10
|
|
|
11
11
|
[project]
|
|
12
12
|
name = "pyqrackising"
|
|
13
|
-
version = "9.5.
|
|
13
|
+
version = "9.5.5"
|
|
14
14
|
requires-python = ">=3.8"
|
|
15
15
|
description = "Fast MAXCUT, TSP, and sampling heuristics from near-ideal transverse field Ising model (TFIM)"
|
|
16
16
|
readme = {file = "README.txt", content-type = "text/markdown"}
|
|
@@ -394,13 +394,13 @@ def init_thresholds(n_qubits):
|
|
|
394
394
|
thresholds = np.empty(n_bias, dtype=np.float64)
|
|
395
395
|
tot_prob = 0
|
|
396
396
|
p = n_qubits
|
|
397
|
-
for q in range(1, n_qubits
|
|
397
|
+
for q in range(1, n_qubits >> 1):
|
|
398
398
|
thresholds[q - 1] = p
|
|
399
399
|
thresholds[n_bias - q] = p
|
|
400
400
|
tot_prob += 2 * p
|
|
401
401
|
p = math.comb(n_qubits, q + 1)
|
|
402
402
|
if n_qubits & 1:
|
|
403
|
-
thresholds[
|
|
403
|
+
thresholds[n_qubits >> 1] = p
|
|
404
404
|
tot_prob += p
|
|
405
405
|
thresholds /= tot_prob
|
|
406
406
|
|
|
@@ -15,25 +15,15 @@ def get_otoc_hamming_distribution(J=-1.0, h=2.0, z=4, theta=0.0, t=5, n_qubits=6
|
|
|
15
15
|
bias[0] = 1.0
|
|
16
16
|
return bias
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
tot_prob = 0
|
|
20
|
-
p = 1.0
|
|
21
|
-
for q in range(n_qubits // 2):
|
|
22
|
-
max_entropy[q] = p
|
|
23
|
-
max_entropy[n_bias - (q + 1)] = p
|
|
24
|
-
tot_prob += 2 * p
|
|
25
|
-
p = math.comb(n_qubits, q + 1)
|
|
26
|
-
if n_qubits & 1:
|
|
27
|
-
max_entropy[q - 1] = p
|
|
28
|
-
tot_prob += p
|
|
29
|
-
max_entropy /= tot_prob
|
|
30
|
-
|
|
18
|
+
entropy_frac = 0.0
|
|
31
19
|
diff_z = np.zeros(n_bias, dtype=np.float64)
|
|
32
20
|
for pauli_string in pauli_strings:
|
|
33
21
|
pauli_string = list(pauli_string)
|
|
34
22
|
if len(pauli_string) != n_qubits:
|
|
35
23
|
raise ValueError("OTOCS pauli_string must be same length as n_qubits! (Use 'I' for qubits that aren't changed.)")
|
|
36
24
|
|
|
25
|
+
entropy_frac += pauli_string.count('X') + pauli_string.count('Y') + pauli_string.count('Z')
|
|
26
|
+
|
|
37
27
|
fwd = probability_by_hamming_weight(J, h, z, theta, t, n_qubits + 1)
|
|
38
28
|
rev = probability_by_hamming_weight(-J, -h, z, theta + np.pi, t, n_qubits + 1)
|
|
39
29
|
diff_theta = rev - fwd
|
|
@@ -49,10 +39,6 @@ def get_otoc_hamming_distribution(J=-1.0, h=2.0, z=4, theta=0.0, t=5, n_qubits=6
|
|
|
49
39
|
diff_phi[0] += 1.0
|
|
50
40
|
diff_lam[0] += 1.0
|
|
51
41
|
|
|
52
|
-
diff_theta += max_entropy
|
|
53
|
-
diff_phi += max_entropy
|
|
54
|
-
diff_lam += max_entropy
|
|
55
|
-
|
|
56
42
|
for b in pauli_string:
|
|
57
43
|
match b:
|
|
58
44
|
case 'X':
|
|
@@ -67,6 +53,24 @@ def get_otoc_hamming_distribution(J=-1.0, h=2.0, z=4, theta=0.0, t=5, n_qubits=6
|
|
|
67
53
|
# Normalize:
|
|
68
54
|
diff_z /= diff_z.sum()
|
|
69
55
|
|
|
56
|
+
entropy_frac = np.atan2(entropy_frac, math.sqrt(n_qubits))
|
|
57
|
+
max_entropy = np.empty(n_bias, dtype=np.float64)
|
|
58
|
+
tot_prob = 0
|
|
59
|
+
p = 1.0
|
|
60
|
+
for q in range(n_qubits >> 1):
|
|
61
|
+
max_entropy[q] = p
|
|
62
|
+
max_entropy[n_bias - (q + 1)] = p
|
|
63
|
+
tot_prob += 2 * p
|
|
64
|
+
p = math.comb(n_qubits, q + 1)
|
|
65
|
+
if n_qubits & 1:
|
|
66
|
+
max_entropy[n_qubits >> 1] = p
|
|
67
|
+
tot_prob += p
|
|
68
|
+
max_entropy *= entropy_frac / tot_prob
|
|
69
|
+
diff_z = max_entropy + (1 - entropy_frac) * diff_z
|
|
70
|
+
|
|
71
|
+
# Normalize:
|
|
72
|
+
diff_z /= diff_z.sum()
|
|
73
|
+
|
|
70
74
|
return diff_z
|
|
71
75
|
|
|
72
76
|
|
|
@@ -145,7 +149,7 @@ def get_willow_inv_dist(butterfly_idx_x, butterfly_idx_z, n_qubits, row_len, col
|
|
|
145
149
|
for q in range(n_qubits):
|
|
146
150
|
q_row, q_col = divmod(q, row_len)
|
|
147
151
|
inv_dist[q] += abs(q_row - b_row) + abs(q_col - b_col)
|
|
148
|
-
inv_dist
|
|
152
|
+
inv_dist -= inv_dist.min()
|
|
149
153
|
|
|
150
154
|
return inv_dist
|
|
151
155
|
|
|
@@ -176,7 +180,7 @@ def get_inv_dist(butterfly_idx_x, butterfly_idx_z, n_qubits, row_len, col_len):
|
|
|
176
180
|
if col_d > half_col:
|
|
177
181
|
col_d = col_len - col_d
|
|
178
182
|
inv_dist[q] += row_d + col_d
|
|
179
|
-
inv_dist
|
|
183
|
+
inv_dist -= inv_dist.min()
|
|
180
184
|
|
|
181
185
|
return inv_dist
|
|
182
186
|
|
|
@@ -188,7 +192,7 @@ def generate_otoc_samples(J=-1.0, h=2.0, z=4, theta=0.0, t=5, n_qubits=65, pauli
|
|
|
188
192
|
for pauli_string in pauli_strings:
|
|
189
193
|
pauli_string = list(pauli_string)
|
|
190
194
|
entropy_frac += pauli_string.count('X') + pauli_string.count('Y') + pauli_string.count('Z')
|
|
191
|
-
entropy_frac
|
|
195
|
+
entropy_frac = np.atan2(entropy_frac, math.sqrt(n_qubits))
|
|
192
196
|
|
|
193
197
|
row_len, col_len = factor_width(n_qubits)
|
|
194
198
|
inv_dist = np.zeros(n_qubits, dtype=np.float64)
|
|
@@ -7,7 +7,7 @@ with open(README_PATH) as readme_file:
|
|
|
7
7
|
|
|
8
8
|
setup(
|
|
9
9
|
name='pyqrackising',
|
|
10
|
-
version='9.5.
|
|
10
|
+
version='9.5.5',
|
|
11
11
|
author='Dan Strano',
|
|
12
12
|
author_email='stranoj@gmail.com',
|
|
13
13
|
description='Fast MAXCUT, TSP, and sampling heuristics from near-ideal transverse field Ising model (TFIM)',
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|