PyQrackIsing 6.3.0__tar.gz → 6.3.1__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-6.3.0/pyqrackising.egg-info → pyqrackising-6.3.1}/PKG-INFO +1 -1
- {pyqrackising-6.3.0 → pyqrackising-6.3.1}/pyproject.toml +1 -1
- {pyqrackising-6.3.0 → pyqrackising-6.3.1}/pyqrackising/maxcut_tfim_streaming.py +6 -6
- {pyqrackising-6.3.0 → pyqrackising-6.3.1}/pyqrackising/spin_glass_solver.py +4 -2
- {pyqrackising-6.3.0 → pyqrackising-6.3.1}/pyqrackising/spin_glass_solver_sparse.py +4 -2
- {pyqrackising-6.3.0 → pyqrackising-6.3.1}/pyqrackising/spin_glass_solver_streaming.py +4 -2
- {pyqrackising-6.3.0 → pyqrackising-6.3.1/pyqrackising.egg-info}/PKG-INFO +1 -1
- {pyqrackising-6.3.0 → pyqrackising-6.3.1}/setup.py +1 -1
- {pyqrackising-6.3.0 → pyqrackising-6.3.1}/CMakeLists.txt +0 -0
- {pyqrackising-6.3.0 → pyqrackising-6.3.1}/LICENSE.md +0 -0
- {pyqrackising-6.3.0 → pyqrackising-6.3.1}/MANIFEST.in +0 -0
- {pyqrackising-6.3.0 → pyqrackising-6.3.1}/README.md +0 -0
- {pyqrackising-6.3.0 → pyqrackising-6.3.1}/pyqrackising/__init__.py +0 -0
- {pyqrackising-6.3.0 → pyqrackising-6.3.1}/pyqrackising/_pyqrack_ising.cpp +0 -0
- {pyqrackising-6.3.0 → pyqrackising-6.3.1}/pyqrackising/convert_tensor_network_to_tsp.py +0 -0
- {pyqrackising-6.3.0 → pyqrackising-6.3.1}/pyqrackising/generate_tfim_samples.py +0 -0
- {pyqrackising-6.3.0 → pyqrackising-6.3.1}/pyqrackising/kernels.cl +0 -0
- {pyqrackising-6.3.0 → pyqrackising-6.3.1}/pyqrackising/maxcut_tfim.py +0 -0
- {pyqrackising-6.3.0 → pyqrackising-6.3.1}/pyqrackising/maxcut_tfim_sparse.py +0 -0
- {pyqrackising-6.3.0 → pyqrackising-6.3.1}/pyqrackising/maxcut_tfim_util.py +0 -0
- {pyqrackising-6.3.0 → pyqrackising-6.3.1}/pyqrackising/spin_glass_solver_util.py +0 -0
- {pyqrackising-6.3.0 → pyqrackising-6.3.1}/pyqrackising/tfim_magnetization.py +0 -0
- {pyqrackising-6.3.0 → pyqrackising-6.3.1}/pyqrackising/tfim_square_magnetization.py +0 -0
- {pyqrackising-6.3.0 → pyqrackising-6.3.1}/pyqrackising/tsp.py +0 -0
- {pyqrackising-6.3.0 → pyqrackising-6.3.1}/pyqrackising.egg-info/SOURCES.txt +0 -0
- {pyqrackising-6.3.0 → pyqrackising-6.3.1}/pyqrackising.egg-info/dependency_links.txt +0 -0
- {pyqrackising-6.3.0 → pyqrackising-6.3.1}/pyqrackising.egg-info/not-zip-safe +0 -0
- {pyqrackising-6.3.0 → pyqrackising-6.3.1}/pyqrackising.egg-info/top_level.txt +0 -0
- {pyqrackising-6.3.0 → pyqrackising-6.3.1}/setup.cfg +0 -0
|
@@ -12,7 +12,7 @@ build-backend = "setuptools.build_meta"
|
|
|
12
12
|
|
|
13
13
|
[project]
|
|
14
14
|
name = "pyqrackising"
|
|
15
|
-
version = "6.3.
|
|
15
|
+
version = "6.3.1"
|
|
16
16
|
requires-python = ">=3.8"
|
|
17
17
|
description = "Fast MAXCUT, TSP, and sampling heuristics from near-ideal transverse field Ising model (TFIM)"
|
|
18
18
|
readme = {file = "README.txt", content-type = "text/markdown"}
|
|
@@ -81,7 +81,8 @@ def compute_energy(sample, G_func, G_func_args_tuple, nodes, n_qubits):
|
|
|
81
81
|
energy = 0
|
|
82
82
|
for u in range(n_qubits):
|
|
83
83
|
for v in range(u + 1, n_qubits):
|
|
84
|
-
|
|
84
|
+
val = G_func((nodes[u], nodes[v]), G_func_args_tuple)
|
|
85
|
+
energy += val if sample[u] == sample[v] else -val
|
|
85
86
|
|
|
86
87
|
return energy
|
|
87
88
|
|
|
@@ -130,7 +131,7 @@ def init_J_and_z(G_func, G_func_args_tuple, nodes, dtype):
|
|
|
130
131
|
val = G_func((nodes[n], nodes[m]), G_func_args_tuple)
|
|
131
132
|
if val != 0.0:
|
|
132
133
|
degree += 1
|
|
133
|
-
|
|
134
|
+
J += val
|
|
134
135
|
G_max = max(val, G_max)
|
|
135
136
|
J = -J / degree if degree > 0 else 0
|
|
136
137
|
degrees[n] = degree
|
|
@@ -180,6 +181,7 @@ def maxcut_tfim_streaming(
|
|
|
180
181
|
is_base_maxcut_gpu=True
|
|
181
182
|
):
|
|
182
183
|
dtype = opencl_context.dtype
|
|
184
|
+
wgs = opencl_context.work_group_size
|
|
183
185
|
n_qubits = len(nodes)
|
|
184
186
|
|
|
185
187
|
if n_qubits < 3:
|
|
@@ -228,7 +230,7 @@ def maxcut_tfim_streaming(
|
|
|
228
230
|
theta_buf = cl.Buffer(opencl_context.ctx, mf.READ_WRITE, size=(n_qubits * 4))
|
|
229
231
|
|
|
230
232
|
# Warp size is 32:
|
|
231
|
-
group_size = min(
|
|
233
|
+
group_size = min(wgs, n_qubits)
|
|
232
234
|
global_size = ((n_qubits + group_size - 1) // group_size) * group_size
|
|
233
235
|
|
|
234
236
|
opencl_context.init_theta_kernel(
|
|
@@ -239,9 +241,7 @@ def maxcut_tfim_streaming(
|
|
|
239
241
|
hamming_prob = init_thresholds(n_qubits, dtype)
|
|
240
242
|
|
|
241
243
|
# Warp size is 32:
|
|
242
|
-
group_size = n_qubits - 1
|
|
243
|
-
if group_size > 256:
|
|
244
|
-
group_size = 256
|
|
244
|
+
group_size = min(wgs, n_qubits - 1)
|
|
245
245
|
grid_dim = n_steps * n_qubits * group_size
|
|
246
246
|
|
|
247
247
|
# Move to GPU
|
|
@@ -143,7 +143,9 @@ def run_bootstrap_opencl(best_theta, G_m_buf, indices_array_np, k, min_energy, i
|
|
|
143
143
|
if min_energy < energy:
|
|
144
144
|
return min_energy
|
|
145
145
|
|
|
146
|
-
|
|
146
|
+
atol = dtype(1.1920928955078125e-7)
|
|
147
|
+
rtol = dtype(0)
|
|
148
|
+
choices = np.where(np.isclose(min_energy_host, energy, atol=atol, rtol=rtol))[0]
|
|
147
149
|
best_i = np.random.choice(choices) if len(choices) else np.argmin(min_energy_host)
|
|
148
150
|
|
|
149
151
|
flip_index_start = best_i * k
|
|
@@ -152,7 +154,7 @@ def run_bootstrap_opencl(best_theta, G_m_buf, indices_array_np, k, min_energy, i
|
|
|
152
154
|
for i in indices_to_flip:
|
|
153
155
|
best_theta[i] = not best_theta[i]
|
|
154
156
|
|
|
155
|
-
return
|
|
157
|
+
return min_energy_host[best_i]
|
|
156
158
|
|
|
157
159
|
|
|
158
160
|
def spin_glass_solver(
|
|
@@ -150,7 +150,9 @@ def run_bootstrap_opencl(best_theta, G_data_buf, G_rows_buf, G_cols_buf, indices
|
|
|
150
150
|
if min_energy < energy:
|
|
151
151
|
return min_energy
|
|
152
152
|
|
|
153
|
-
|
|
153
|
+
atol = dtype(1.1920928955078125e-7)
|
|
154
|
+
rtol = dtype(0)
|
|
155
|
+
choices = np.where(np.isclose(min_energy_host, energy, atol=atol, rtol=rtol))[0]
|
|
154
156
|
best_i = np.random.choice(choices) if len(choices) else np.argmin(min_energy_host)
|
|
155
157
|
|
|
156
158
|
flip_index_start = best_i * k
|
|
@@ -159,7 +161,7 @@ def run_bootstrap_opencl(best_theta, G_data_buf, G_rows_buf, G_cols_buf, indices
|
|
|
159
161
|
for i in indices_to_flip:
|
|
160
162
|
best_theta[i] = not best_theta[i]
|
|
161
163
|
|
|
162
|
-
return
|
|
164
|
+
return min_energy_host[best_i]
|
|
163
165
|
|
|
164
166
|
|
|
165
167
|
def to_scipy_sparse_upper_triangular(G, nodes, n_nodes, dtype):
|
|
@@ -52,9 +52,11 @@ def bootstrap(best_theta, G_func, G_func_args_tuple, nodes, indices_array, k, mi
|
|
|
52
52
|
|
|
53
53
|
energy = energies.min()
|
|
54
54
|
if energy < min_energy:
|
|
55
|
-
|
|
55
|
+
atol = dtype(1.1920928955078125e-7)
|
|
56
|
+
rtol = dtype(0)
|
|
57
|
+
index_match = np.random.choice(np.where(np.isclose(energies, energy, atol=atol, rtol=rtol))[0])
|
|
56
58
|
indices = indices_array[(index_match * k) : ((index_match + 1) * k)]
|
|
57
|
-
min_energy =
|
|
59
|
+
min_energy = energies[index_match]
|
|
58
60
|
for i in indices:
|
|
59
61
|
best_theta[i] = not best_theta[i]
|
|
60
62
|
|
|
@@ -51,7 +51,7 @@ ext_modules = [CMakeExtension('tfim_sampler')]
|
|
|
51
51
|
|
|
52
52
|
setup(
|
|
53
53
|
name='pyqrackising',
|
|
54
|
-
version='6.3.
|
|
54
|
+
version='6.3.1',
|
|
55
55
|
author='Dan Strano',
|
|
56
56
|
author_email='stranoj@gmail.com',
|
|
57
57
|
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
|