PyQrackIsing 5.1.1__tar.gz → 5.1.2__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-5.1.1/pyqrackising.egg-info → pyqrackising-5.1.2}/PKG-INFO +1 -1
- {pyqrackising-5.1.1 → pyqrackising-5.1.2}/pyproject.toml +1 -1
- {pyqrackising-5.1.1 → pyqrackising-5.1.2}/pyqrackising/maxcut_tfim.py +5 -6
- {pyqrackising-5.1.1 → pyqrackising-5.1.2}/pyqrackising/maxcut_tfim_sparse.py +8 -8
- {pyqrackising-5.1.1 → pyqrackising-5.1.2}/pyqrackising/maxcut_tfim_streaming.py +6 -8
- {pyqrackising-5.1.1 → pyqrackising-5.1.2/pyqrackising.egg-info}/PKG-INFO +1 -1
- {pyqrackising-5.1.1 → pyqrackising-5.1.2}/setup.py +1 -1
- {pyqrackising-5.1.1 → pyqrackising-5.1.2}/CMakeLists.txt +0 -0
- {pyqrackising-5.1.1 → pyqrackising-5.1.2}/LICENSE.md +0 -0
- {pyqrackising-5.1.1 → pyqrackising-5.1.2}/MANIFEST.in +0 -0
- {pyqrackising-5.1.1 → pyqrackising-5.1.2}/README.md +0 -0
- {pyqrackising-5.1.1 → pyqrackising-5.1.2}/pyqrackising/__init__.py +0 -0
- {pyqrackising-5.1.1 → pyqrackising-5.1.2}/pyqrackising/_pyqrack_ising.cpp +0 -0
- {pyqrackising-5.1.1 → pyqrackising-5.1.2}/pyqrackising/generate_tfim_samples.py +0 -0
- {pyqrackising-5.1.1 → pyqrackising-5.1.2}/pyqrackising/kernels.cl +0 -0
- {pyqrackising-5.1.1 → pyqrackising-5.1.2}/pyqrackising/maxcut_tfim_util.py +0 -0
- {pyqrackising-5.1.1 → pyqrackising-5.1.2}/pyqrackising/spin_glass_solver.py +0 -0
- {pyqrackising-5.1.1 → pyqrackising-5.1.2}/pyqrackising/spin_glass_solver_sparse.py +0 -0
- {pyqrackising-5.1.1 → pyqrackising-5.1.2}/pyqrackising/spin_glass_solver_streaming.py +0 -0
- {pyqrackising-5.1.1 → pyqrackising-5.1.2}/pyqrackising/tfim_magnetization.py +0 -0
- {pyqrackising-5.1.1 → pyqrackising-5.1.2}/pyqrackising/tfim_square_magnetization.py +0 -0
- {pyqrackising-5.1.1 → pyqrackising-5.1.2}/pyqrackising/tsp.py +0 -0
- {pyqrackising-5.1.1 → pyqrackising-5.1.2}/pyqrackising.egg-info/SOURCES.txt +0 -0
- {pyqrackising-5.1.1 → pyqrackising-5.1.2}/pyqrackising.egg-info/dependency_links.txt +0 -0
- {pyqrackising-5.1.1 → pyqrackising-5.1.2}/pyqrackising.egg-info/not-zip-safe +0 -0
- {pyqrackising-5.1.1 → pyqrackising-5.1.2}/pyqrackising.egg-info/top_level.txt +0 -0
- {pyqrackising-5.1.1 → pyqrackising-5.1.2}/setup.cfg +0 -0
|
@@ -12,7 +12,7 @@ build-backend = "setuptools.build_meta"
|
|
|
12
12
|
|
|
13
13
|
[project]
|
|
14
14
|
name = "pyqrackising"
|
|
15
|
-
version = "5.1.
|
|
15
|
+
version = "5.1.2"
|
|
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"}
|
|
@@ -193,20 +193,19 @@ def sample_for_solution(G_m, shots, thresholds, degrees_sum, J_eff, n):
|
|
|
193
193
|
return best_solution, best_value
|
|
194
194
|
|
|
195
195
|
|
|
196
|
-
@njit
|
|
196
|
+
@njit(parallel=True)
|
|
197
197
|
def init_J_and_z(G_m):
|
|
198
198
|
n_qubits = len(G_m)
|
|
199
199
|
degrees = np.empty(n_qubits, dtype=np.uint32)
|
|
200
200
|
J_eff = np.empty(n_qubits, dtype=np.float64)
|
|
201
201
|
J_max = -float("inf")
|
|
202
|
-
for n in
|
|
202
|
+
for n in prange(n_qubits):
|
|
203
203
|
degree = sum(G_m[n] != 0.0)
|
|
204
204
|
J = -G_m[n].sum() / degree if degree > 0 else 0
|
|
205
205
|
degrees[n] = degree
|
|
206
206
|
J_eff[n] = J
|
|
207
207
|
J_abs = abs(J)
|
|
208
|
-
|
|
209
|
-
J_max = J_abs
|
|
208
|
+
J_max = max(J_abs, J_max)
|
|
210
209
|
J_eff /= J_max
|
|
211
210
|
|
|
212
211
|
return J_eff, degrees
|
|
@@ -233,10 +232,10 @@ def init_thresholds(n_qubits):
|
|
|
233
232
|
return thresholds
|
|
234
233
|
|
|
235
234
|
|
|
236
|
-
@njit
|
|
235
|
+
@njit(parallel=True)
|
|
237
236
|
def init_theta(delta_t, tot_t, h_mult, n_qubits, J_eff, degrees):
|
|
238
237
|
theta = np.empty(n_qubits, dtype=np.float64)
|
|
239
|
-
for q in
|
|
238
|
+
for q in prange(n_qubits):
|
|
240
239
|
J = J_eff[q]
|
|
241
240
|
z = degrees[q]
|
|
242
241
|
theta[q] = np.arcsin(
|
|
@@ -225,13 +225,12 @@ def sample_for_solution(G_data, G_rows, G_cols, shots, thresholds, J_eff):
|
|
|
225
225
|
return best_solution, best_value
|
|
226
226
|
|
|
227
227
|
|
|
228
|
-
@njit
|
|
228
|
+
@njit(parallel=True)
|
|
229
229
|
def init_J_and_z(G_data, G_rows, G_cols):
|
|
230
230
|
n_qubits = G_rows.shape[0] - 1
|
|
231
231
|
degrees = np.empty(n_qubits, dtype=np.uint32)
|
|
232
232
|
J_eff = np.empty(n_qubits, dtype=np.float64)
|
|
233
|
-
|
|
234
|
-
for r in range(n_qubits):
|
|
233
|
+
for r in prange(n_qubits):
|
|
235
234
|
# Row sum
|
|
236
235
|
start = G_rows[r]
|
|
237
236
|
end = G_rows[r + 1]
|
|
@@ -248,17 +247,18 @@ def init_J_and_z(G_data, G_rows, G_cols):
|
|
|
248
247
|
degrees[c] += 1
|
|
249
248
|
J_eff[c] += G_data[idx]
|
|
250
249
|
|
|
251
|
-
|
|
250
|
+
J_max = -float("inf")
|
|
251
|
+
for r in prange(n_qubits):
|
|
252
252
|
J = J_eff[r]
|
|
253
253
|
degree = degrees[r]
|
|
254
254
|
J_eff[r] = -J / degree if degree > 0 else 0
|
|
255
255
|
J_abs = abs(J)
|
|
256
|
-
|
|
257
|
-
J_max = J_abs
|
|
256
|
+
J_max = max(J_abs, J_max)
|
|
258
257
|
J_eff /= J_max
|
|
259
258
|
|
|
260
259
|
return J_eff, degrees
|
|
261
260
|
|
|
261
|
+
|
|
262
262
|
@njit
|
|
263
263
|
def init_thresholds(n_qubits):
|
|
264
264
|
n_bias = n_qubits - 1
|
|
@@ -280,10 +280,10 @@ def init_thresholds(n_qubits):
|
|
|
280
280
|
return thresholds
|
|
281
281
|
|
|
282
282
|
|
|
283
|
-
@njit
|
|
283
|
+
@njit(parallel=True)
|
|
284
284
|
def init_theta(delta_t, tot_t, h_mult, n_qubits, J_eff, degrees):
|
|
285
285
|
theta = np.empty(n_qubits, dtype=np.float64)
|
|
286
|
-
for q in
|
|
286
|
+
for q in prange(n_qubits):
|
|
287
287
|
J = J_eff[q]
|
|
288
288
|
z = degrees[q]
|
|
289
289
|
theta[q] = np.arcsin(
|
|
@@ -192,14 +192,14 @@ def sample_for_solution(G_func, G_func_args_tuple, nodes, max_weight, shots, thr
|
|
|
192
192
|
return best_solution, best_value
|
|
193
193
|
|
|
194
194
|
|
|
195
|
-
@njit
|
|
195
|
+
@njit(parallel=True)
|
|
196
196
|
def init_J_and_z(G_func, G_func_args_tuple, nodes):
|
|
197
197
|
n_qubits = len(nodes)
|
|
198
198
|
degrees = np.empty(n_qubits, dtype=np.uint32)
|
|
199
199
|
J_eff = np.empty(n_qubits, dtype=np.float64)
|
|
200
200
|
J_max = -float("inf")
|
|
201
201
|
G_max = -float("inf")
|
|
202
|
-
for n in
|
|
202
|
+
for n in prange(n_qubits):
|
|
203
203
|
degree = 0
|
|
204
204
|
J = 0.0
|
|
205
205
|
for m in range(n_qubits):
|
|
@@ -207,14 +207,12 @@ def init_J_and_z(G_func, G_func_args_tuple, nodes):
|
|
|
207
207
|
if val != 0.0:
|
|
208
208
|
degree += 1
|
|
209
209
|
J += val
|
|
210
|
-
|
|
211
|
-
G_max = val
|
|
210
|
+
G_max = max(val, G_max)
|
|
212
211
|
J = -J / degree if degree > 0 else 0
|
|
213
212
|
degrees[n] = degree
|
|
214
213
|
J_eff[n] = J
|
|
215
214
|
J_abs = abs(J)
|
|
216
|
-
|
|
217
|
-
J_max = J_abs
|
|
215
|
+
J_max = max(J_abs, J_max)
|
|
218
216
|
J_eff /= J_max
|
|
219
217
|
|
|
220
218
|
return J_eff, degrees, G_max
|
|
@@ -241,10 +239,10 @@ def init_thresholds(n_qubits):
|
|
|
241
239
|
return thresholds
|
|
242
240
|
|
|
243
241
|
|
|
244
|
-
@njit
|
|
242
|
+
@njit(parallel=True)
|
|
245
243
|
def init_theta(delta_t, tot_t, h_mult, n_qubits, J_eff, degrees):
|
|
246
244
|
theta = np.empty(n_qubits, dtype=np.float64)
|
|
247
|
-
for q in
|
|
245
|
+
for q in prange(n_qubits):
|
|
248
246
|
J = J_eff[q]
|
|
249
247
|
z = degrees[q]
|
|
250
248
|
theta[q] = np.arcsin(
|
|
@@ -51,7 +51,7 @@ ext_modules = [CMakeExtension('tfim_sampler')]
|
|
|
51
51
|
|
|
52
52
|
setup(
|
|
53
53
|
name='pyqrackising',
|
|
54
|
-
version='5.1.
|
|
54
|
+
version='5.1.2',
|
|
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
|