PyQrackIsing 9.12.1__tar.gz → 9.12.3__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.
- {pyqrackising-9.12.1/pyqrackising.egg-info → pyqrackising-9.12.3}/PKG-INFO +1 -1
- {pyqrackising-9.12.1 → pyqrackising-9.12.3}/pyproject.toml +1 -1
- {pyqrackising-9.12.1 → pyqrackising-9.12.3}/pyqrackising/maxcut_tfim.py +7 -7
- {pyqrackising-9.12.1 → pyqrackising-9.12.3}/pyqrackising/maxcut_tfim_sparse.py +6 -6
- {pyqrackising-9.12.1 → pyqrackising-9.12.3}/pyqrackising/maxcut_tfim_streaming.py +7 -7
- {pyqrackising-9.12.1 → pyqrackising-9.12.3}/pyqrackising/maxcut_tfim_util.py +748 -739
- pyqrackising-9.12.3/pyqrackising/solve_maxcut_exact.py +305 -0
- pyqrackising-9.12.3/pyqrackising/solve_maxcut_exact_sparse.py +227 -0
- pyqrackising-9.12.3/pyqrackising/solve_maxcut_exact_streaming.py +217 -0
- {pyqrackising-9.12.1 → pyqrackising-9.12.3}/pyqrackising/spin_glass_solver.py +4 -4
- {pyqrackising-9.12.1 → pyqrackising-9.12.3}/pyqrackising/spin_glass_solver_sparse.py +4 -4
- {pyqrackising-9.12.1 → pyqrackising-9.12.3}/pyqrackising/spin_glass_solver_streaming.py +4 -4
- {pyqrackising-9.12.1 → pyqrackising-9.12.3}/pyqrackising/tsp.py +45 -45
- {pyqrackising-9.12.1 → pyqrackising-9.12.3}/pyqrackising/tsp_maxcut.py +8 -8
- {pyqrackising-9.12.1 → pyqrackising-9.12.3/pyqrackising.egg-info}/PKG-INFO +1 -1
- {pyqrackising-9.12.1 → pyqrackising-9.12.3}/setup.py +1 -1
- pyqrackising-9.12.1/pyqrackising/solve_maxcut_exact.py +0 -355
- pyqrackising-9.12.1/pyqrackising/solve_maxcut_exact_sparse.py +0 -404
- pyqrackising-9.12.1/pyqrackising/solve_maxcut_exact_streaming.py +0 -356
- {pyqrackising-9.12.1 → pyqrackising-9.12.3}/LICENSE.md +0 -0
- {pyqrackising-9.12.1 → pyqrackising-9.12.3}/MANIFEST.in +0 -0
- {pyqrackising-9.12.1 → pyqrackising-9.12.3}/README.md +0 -0
- {pyqrackising-9.12.1 → pyqrackising-9.12.3}/pyqrackising/__init__.py +0 -0
- {pyqrackising-9.12.1 → pyqrackising-9.12.3}/pyqrackising/convert_tensor_network_to_tsp.py +0 -0
- {pyqrackising-9.12.1 → pyqrackising-9.12.3}/pyqrackising/generate_tfim_samples.py +0 -0
- {pyqrackising-9.12.1 → pyqrackising-9.12.3}/pyqrackising/kernels.cl +0 -0
- {pyqrackising-9.12.1 → pyqrackising-9.12.3}/pyqrackising/otoc.py +0 -0
- {pyqrackising-9.12.1 → pyqrackising-9.12.3}/pyqrackising/tfim_magnetization.py +0 -0
- {pyqrackising-9.12.1 → pyqrackising-9.12.3}/pyqrackising/tfim_square_magnetization.py +0 -0
- {pyqrackising-9.12.1 → pyqrackising-9.12.3}/pyqrackising.egg-info/SOURCES.txt +0 -0
- {pyqrackising-9.12.1 → pyqrackising-9.12.3}/pyqrackising.egg-info/dependency_links.txt +0 -0
- {pyqrackising-9.12.1 → pyqrackising-9.12.3}/pyqrackising.egg-info/not-zip-safe +0 -0
- {pyqrackising-9.12.1 → pyqrackising-9.12.3}/pyqrackising.egg-info/requires.txt +0 -0
- {pyqrackising-9.12.1 → pyqrackising-9.12.3}/pyqrackising.egg-info/top_level.txt +0 -0
- {pyqrackising-9.12.1 → pyqrackising-9.12.3}/setup.cfg +0 -0
|
@@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"
|
|
|
7
7
|
|
|
8
8
|
[project]
|
|
9
9
|
name = "pyqrackising"
|
|
10
|
-
version = "9.12.
|
|
10
|
+
version = "9.12.3"
|
|
11
11
|
requires-python = ">=3.8"
|
|
12
12
|
description = "Fast MAXCUT, TSP, and sampling heuristics from near-ideal transverse field Ising model (TFIM)"
|
|
13
13
|
readme = {file = "README.txt", content-type = "text/markdown"}
|
|
@@ -33,7 +33,7 @@ dtype = opencl_context.dtype
|
|
|
33
33
|
wgs = opencl_context.work_group_size
|
|
34
34
|
|
|
35
35
|
|
|
36
|
-
@njit
|
|
36
|
+
@njit(cache=True)
|
|
37
37
|
def update_repulsion_choice(G_m, weights, n, used, node, repulsion_base):
|
|
38
38
|
# Select node
|
|
39
39
|
used[node] = True
|
|
@@ -49,7 +49,7 @@ def update_repulsion_choice(G_m, weights, n, used, node, repulsion_base):
|
|
|
49
49
|
|
|
50
50
|
|
|
51
51
|
# Written by Elara (OpenAI custom GPT) and improved by Dan Strano
|
|
52
|
-
@njit
|
|
52
|
+
@njit(cache=True)
|
|
53
53
|
def local_repulsion_choice(G_m, repulsion_base, n, m, s):
|
|
54
54
|
"""
|
|
55
55
|
Pick m nodes out of n with repulsion bias:
|
|
@@ -78,7 +78,7 @@ def local_repulsion_choice(G_m, repulsion_base, n, m, s):
|
|
|
78
78
|
return used
|
|
79
79
|
|
|
80
80
|
|
|
81
|
-
@njit(parallel=True)
|
|
81
|
+
@njit(parallel=True, cache=True)
|
|
82
82
|
def sample_measurement(G_m, shots, thread_count, thresholds, repulsion_base, is_spin_glass):
|
|
83
83
|
shot_segment = (max(1, shots >> 1) + thread_count - 1) // thread_count
|
|
84
84
|
shots = shot_segment * thread_count
|
|
@@ -140,7 +140,7 @@ def sample_measurement(G_m, shots, thread_count, thresholds, repulsion_base, is_
|
|
|
140
140
|
return best_solution, best_energy
|
|
141
141
|
|
|
142
142
|
|
|
143
|
-
@njit(parallel=True)
|
|
143
|
+
@njit(parallel=True, cache=True)
|
|
144
144
|
def shot_loop(G_m, thresholds, repulsion_base, n, shots, solutions):
|
|
145
145
|
for s in prange(shots):
|
|
146
146
|
# First dimension: Hamming weight
|
|
@@ -190,7 +190,7 @@ def sample_for_opencl(
|
|
|
190
190
|
return best_solution, float(best_energy)
|
|
191
191
|
|
|
192
192
|
|
|
193
|
-
@njit(parallel=True)
|
|
193
|
+
@njit(parallel=True, cache=True)
|
|
194
194
|
def init_J_and_z(G_m, repulsion_base):
|
|
195
195
|
G_min = G_m.min()
|
|
196
196
|
n_qubits = len(G_m)
|
|
@@ -289,7 +289,7 @@ def run_cut_opencl(
|
|
|
289
289
|
return samples[max_index_host[best_x]].copy(), energy
|
|
290
290
|
|
|
291
291
|
|
|
292
|
-
@njit
|
|
292
|
+
@njit(cache=True)
|
|
293
293
|
def exact_maxcut(G):
|
|
294
294
|
"""Brute-force exact MAXCUT solver using Numba JIT."""
|
|
295
295
|
n = G.shape[0]
|
|
@@ -316,7 +316,7 @@ def exact_maxcut(G):
|
|
|
316
316
|
return best_bits, max_cut
|
|
317
317
|
|
|
318
318
|
|
|
319
|
-
@njit
|
|
319
|
+
@njit(cache=True)
|
|
320
320
|
def exact_spin_glass(G):
|
|
321
321
|
"""Brute-force exact spin-glass solver using Numba JIT."""
|
|
322
322
|
n = G.shape[0]
|
|
@@ -34,7 +34,7 @@ dtype = opencl_context.dtype
|
|
|
34
34
|
wgs = opencl_context.work_group_size
|
|
35
35
|
|
|
36
36
|
|
|
37
|
-
@njit
|
|
37
|
+
@njit(cache=True)
|
|
38
38
|
def update_repulsion_choice(G_data, G_rows, G_cols, weights, n, used, node, repulsion_base):
|
|
39
39
|
# Select node
|
|
40
40
|
used[node] = True
|
|
@@ -60,7 +60,7 @@ def update_repulsion_choice(G_data, G_rows, G_cols, weights, n, used, node, repu
|
|
|
60
60
|
|
|
61
61
|
|
|
62
62
|
# Written by Elara (OpenAI custom GPT) and improved by Dan Strano
|
|
63
|
-
@njit
|
|
63
|
+
@njit(cache=True)
|
|
64
64
|
def local_repulsion_choice(G_data, G_rows, G_cols, repulsion_base, n, m, s):
|
|
65
65
|
"""
|
|
66
66
|
Pick m nodes out of n with repulsion bias:
|
|
@@ -89,7 +89,7 @@ def local_repulsion_choice(G_data, G_rows, G_cols, repulsion_base, n, m, s):
|
|
|
89
89
|
return used
|
|
90
90
|
|
|
91
91
|
|
|
92
|
-
@njit(parallel=True)
|
|
92
|
+
@njit(parallel=True, cache=True)
|
|
93
93
|
def sample_measurement(G_data, G_rows, G_cols, shots, thread_count, thresholds, repulsion_base, is_spin_glass):
|
|
94
94
|
shot_segment = (max(1, shots >> 1) + thread_count - 1) // thread_count
|
|
95
95
|
shots = shot_segment * thread_count
|
|
@@ -148,7 +148,7 @@ def sample_measurement(G_data, G_rows, G_cols, shots, thread_count, thresholds,
|
|
|
148
148
|
return best_solution, best_energy
|
|
149
149
|
|
|
150
150
|
|
|
151
|
-
@njit(parallel=True)
|
|
151
|
+
@njit(parallel=True, cache=True)
|
|
152
152
|
def shot_loop(G_data, G_rows, G_cols, thresholds, repulsion_base, n, shots, solutions):
|
|
153
153
|
for s in prange(shots):
|
|
154
154
|
# First dimension: Hamming weight
|
|
@@ -307,7 +307,7 @@ def run_cut_opencl(
|
|
|
307
307
|
return samples[max_index_host[best_x]].copy(), energy
|
|
308
308
|
|
|
309
309
|
|
|
310
|
-
@njit
|
|
310
|
+
@njit(cache=True)
|
|
311
311
|
def exact_maxcut(G_data, G_rows, G_cols):
|
|
312
312
|
"""Brute-force exact MAXCUT solver using Numba JIT."""
|
|
313
313
|
n = G_rows.shape[0] - 1
|
|
@@ -339,7 +339,7 @@ def exact_maxcut(G_data, G_rows, G_cols):
|
|
|
339
339
|
return best_bits, max_cut
|
|
340
340
|
|
|
341
341
|
|
|
342
|
-
@njit
|
|
342
|
+
@njit(cache=True)
|
|
343
343
|
def exact_spin_glass(G_data, G_rows, G_cols):
|
|
344
344
|
"""Brute-force exact spin-glass solver using Numba JIT."""
|
|
345
345
|
n = G_rows.shape[0] - 1
|
|
@@ -22,7 +22,7 @@ epsilon = opencl_context.epsilon
|
|
|
22
22
|
dtype = opencl_context.dtype
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
@njit
|
|
25
|
+
@njit(cache=True)
|
|
26
26
|
def update_repulsion_choice(G_func, nodes, weights, n, used, node, repulsion_base):
|
|
27
27
|
# Select node
|
|
28
28
|
used[node] = True
|
|
@@ -38,7 +38,7 @@ def update_repulsion_choice(G_func, nodes, weights, n, used, node, repulsion_bas
|
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
# Written by Elara (OpenAI custom GPT) and improved by Dan Strano
|
|
41
|
-
@njit
|
|
41
|
+
@njit(cache=True)
|
|
42
42
|
def local_repulsion_choice(G_func, nodes, repulsion_base, n, m, s):
|
|
43
43
|
"""
|
|
44
44
|
Pick m nodes out of n with repulsion bias:
|
|
@@ -67,7 +67,7 @@ def local_repulsion_choice(G_func, nodes, repulsion_base, n, m, s):
|
|
|
67
67
|
return used
|
|
68
68
|
|
|
69
69
|
|
|
70
|
-
@njit(parallel=True)
|
|
70
|
+
@njit(parallel=True, cache=True)
|
|
71
71
|
def sample_measurement(G_func, nodes, shots, thread_count, thresholds, n, repulsion_base, is_spin_glass):
|
|
72
72
|
shot_segment = (max(1, shots >> 1) + thread_count - 1) // thread_count
|
|
73
73
|
shots = shot_segment * thread_count
|
|
@@ -128,7 +128,7 @@ def sample_measurement(G_func, nodes, shots, thread_count, thresholds, n, repuls
|
|
|
128
128
|
return best_solution, best_energy
|
|
129
129
|
|
|
130
130
|
|
|
131
|
-
@njit(parallel=True)
|
|
131
|
+
@njit(parallel=True, cache=True)
|
|
132
132
|
def init_J_and_z(G_func, nodes, G_min, repulsion_base):
|
|
133
133
|
n_qubits = len(nodes)
|
|
134
134
|
degrees = np.empty(n_qubits, dtype=np.uint32)
|
|
@@ -150,7 +150,7 @@ def init_J_and_z(G_func, nodes, G_min, repulsion_base):
|
|
|
150
150
|
return J_eff, degrees
|
|
151
151
|
|
|
152
152
|
|
|
153
|
-
@njit
|
|
153
|
+
@njit(cache=True)
|
|
154
154
|
def find_G_min(G_func, nodes, n_nodes):
|
|
155
155
|
G_min = float("inf")
|
|
156
156
|
for i in range(n_nodes):
|
|
@@ -164,7 +164,7 @@ def find_G_min(G_func, nodes, n_nodes):
|
|
|
164
164
|
return G_min
|
|
165
165
|
|
|
166
166
|
|
|
167
|
-
@njit
|
|
167
|
+
@njit(cache=True)
|
|
168
168
|
def exact_maxcut(G_func, n):
|
|
169
169
|
"""Brute-force exact MAXCUT solver using Numba JIT."""
|
|
170
170
|
max_cut = -1.0
|
|
@@ -190,7 +190,7 @@ def exact_maxcut(G_func, n):
|
|
|
190
190
|
return best_bits, max_cut
|
|
191
191
|
|
|
192
192
|
|
|
193
|
-
@njit
|
|
193
|
+
@njit(cache=True)
|
|
194
194
|
def exact_spin_glass(G_func, n):
|
|
195
195
|
"""Brute-force exact spin-glass solver using Numba JIT."""
|
|
196
196
|
max_cut = -1.0
|