PyQrackIsing 9.2.2__py3-none-win_amd64.whl → 9.2.4__py3-none-win_amd64.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.
- pyqrackising/spin_glass_solver.py +31 -5
- pyqrackising/spin_glass_solver_sparse.py +31 -5
- pyqrackising/spin_glass_solver_streaming.py +23 -5
- {pyqrackising-9.2.2.dist-info → pyqrackising-9.2.4.dist-info}/METADATA +1 -1
- {pyqrackising-9.2.2.dist-info → pyqrackising-9.2.4.dist-info}/RECORD +8 -8
- {pyqrackising-9.2.2.dist-info → pyqrackising-9.2.4.dist-info}/WHEEL +0 -0
- {pyqrackising-9.2.2.dist-info → pyqrackising-9.2.4.dist-info}/licenses/LICENSE.md +0 -0
- {pyqrackising-9.2.2.dist-info → pyqrackising-9.2.4.dist-info}/top_level.txt +0 -0
|
@@ -140,18 +140,17 @@ def pick_gray_seeds(best_theta, thread_count, gray_seed_multiple, G_m, n, is_spi
|
|
|
140
140
|
return best_seeds, best_energies
|
|
141
141
|
|
|
142
142
|
@njit(parallel=True)
|
|
143
|
-
def run_gray_optimization(best_theta, iterators, gray_iterations, thread_count, is_spin_glass, G_m):
|
|
143
|
+
def run_gray_optimization(best_theta, iterators, energies, gray_iterations, thread_count, is_spin_glass, G_m):
|
|
144
144
|
n = len(best_theta)
|
|
145
145
|
thread_iterations = (gray_iterations + thread_count - 1) // thread_count
|
|
146
146
|
blocks = (n + 63) // 64
|
|
147
147
|
|
|
148
148
|
states = np.empty((thread_count, n), dtype=np.bool_)
|
|
149
|
-
energies = np.full(thread_count, np.finfo(dtype).min, dtype=dtype)
|
|
150
149
|
|
|
151
150
|
if is_spin_glass:
|
|
152
151
|
for i in prange(thread_count):
|
|
153
152
|
iterator = iterators[i].copy()
|
|
154
|
-
best_energy, best_iterator =
|
|
153
|
+
best_energy, best_iterator = energies[i], iterator.copy()
|
|
155
154
|
for curr_idx in range(thread_iterations):
|
|
156
155
|
for block in range(blocks):
|
|
157
156
|
gray_code_next(iterator, curr_idx, block * 64)
|
|
@@ -165,7 +164,7 @@ def run_gray_optimization(best_theta, iterators, gray_iterations, thread_count,
|
|
|
165
164
|
else:
|
|
166
165
|
for i in prange(thread_count):
|
|
167
166
|
iterator = iterators[i].copy()
|
|
168
|
-
best_energy, best_iterator =
|
|
167
|
+
best_energy, best_iterator = energies[i], iterator.copy()
|
|
169
168
|
for curr_idx in range(thread_iterations):
|
|
170
169
|
for block in range(blocks):
|
|
171
170
|
gray_code_next(iterator, curr_idx, block * 64)
|
|
@@ -372,7 +371,34 @@ def spin_glass_solver(
|
|
|
372
371
|
improved = True
|
|
373
372
|
continue
|
|
374
373
|
|
|
375
|
-
energy, state = run_gray_optimization(best_theta, iterators, gray_iterations, thread_count, is_spin_glass, G_m)
|
|
374
|
+
energy, state = run_gray_optimization(best_theta, iterators, energies, gray_iterations, thread_count, is_spin_glass, G_m)
|
|
375
|
+
if energy > max_energy:
|
|
376
|
+
max_energy = energy
|
|
377
|
+
best_theta = state
|
|
378
|
+
improved = True
|
|
379
|
+
continue
|
|
380
|
+
|
|
381
|
+
# Post-reheat phase
|
|
382
|
+
reheat_theta = state
|
|
383
|
+
|
|
384
|
+
# Single bit flips with O(n^2)
|
|
385
|
+
if is_opencl:
|
|
386
|
+
theta_buf = make_best_theta_buf(reheat_theta)
|
|
387
|
+
energy, state = run_bit_flips_opencl(False, n_qubits, single_bit_flips_kernel, max_energy, reheat_theta, theta_buf, G_m_buf, is_segmented, *opencl_args)
|
|
388
|
+
else:
|
|
389
|
+
energy, state = run_single_bit_flips(reheat_theta, is_spin_glass, G_m)
|
|
390
|
+
if energy > max_energy:
|
|
391
|
+
max_energy = energy
|
|
392
|
+
best_theta = state
|
|
393
|
+
improved = True
|
|
394
|
+
continue
|
|
395
|
+
|
|
396
|
+
# Double bit flips with O(n^3)
|
|
397
|
+
if is_opencl:
|
|
398
|
+
# theta_buf has not changed
|
|
399
|
+
energy, state = run_bit_flips_opencl(True, n_qubits, double_bit_flips_kernel, max_energy, reheat_theta, theta_buf, G_m_buf, is_segmented, *opencl_args)
|
|
400
|
+
else:
|
|
401
|
+
energy, state = run_double_bit_flips(reheat_theta, is_spin_glass, G_m, thread_count)
|
|
376
402
|
if energy > max_energy:
|
|
377
403
|
max_energy = energy
|
|
378
404
|
best_theta = state
|
|
@@ -140,18 +140,17 @@ def pick_gray_seeds(best_theta, thread_count, gray_seed_multiple, G_data, G_rows
|
|
|
140
140
|
return best_seeds, best_energies
|
|
141
141
|
|
|
142
142
|
@njit(parallel=True)
|
|
143
|
-
def run_gray_optimization(best_theta, iterators, gray_iterations, thread_count, is_spin_glass, G_data, G_rows, G_cols):
|
|
143
|
+
def run_gray_optimization(best_theta, iterators, energies, gray_iterations, thread_count, is_spin_glass, G_data, G_rows, G_cols):
|
|
144
144
|
n = len(best_theta)
|
|
145
145
|
thread_iterations = (gray_iterations + thread_count - 1) // thread_count
|
|
146
146
|
blocks = (n + 63) // 64
|
|
147
147
|
|
|
148
148
|
states = np.empty((thread_count, n), dtype=np.bool_)
|
|
149
|
-
energies = np.full(thread_count, np.finfo(dtype).min, dtype=dtype)
|
|
150
149
|
|
|
151
150
|
if is_spin_glass:
|
|
152
151
|
for i in prange(thread_count):
|
|
153
152
|
iterator = iterators[i].copy()
|
|
154
|
-
best_energy, best_iterator =
|
|
153
|
+
best_energy, best_iterator = energies[i], iterator.copy()
|
|
155
154
|
for curr_idx in range(thread_iterations):
|
|
156
155
|
for block in range(blocks):
|
|
157
156
|
gray_code_next(iterator, curr_idx, block * 64)
|
|
@@ -165,7 +164,7 @@ def run_gray_optimization(best_theta, iterators, gray_iterations, thread_count,
|
|
|
165
164
|
else:
|
|
166
165
|
for i in prange(thread_count):
|
|
167
166
|
iterator = iterators[i].copy()
|
|
168
|
-
best_energy, best_iterator =
|
|
167
|
+
best_energy, best_iterator = energies[i], iterator.copy()
|
|
169
168
|
for curr_idx in range(thread_iterations):
|
|
170
169
|
for block in range(blocks):
|
|
171
170
|
gray_code_next(iterator, curr_idx, block * 64)
|
|
@@ -376,7 +375,34 @@ def spin_glass_solver_sparse(
|
|
|
376
375
|
improved = True
|
|
377
376
|
continue
|
|
378
377
|
|
|
379
|
-
energy, state = run_gray_optimization(best_theta, iterators, gray_iterations, thread_count, is_spin_glass, G_m.data, G_m.indptr, G_m.indices)
|
|
378
|
+
energy, state = run_gray_optimization(best_theta, iterators, energies, gray_iterations, thread_count, is_spin_glass, G_m.data, G_m.indptr, G_m.indices)
|
|
379
|
+
if energy > max_energy:
|
|
380
|
+
max_energy = energy
|
|
381
|
+
best_theta = state
|
|
382
|
+
improved = True
|
|
383
|
+
continue
|
|
384
|
+
|
|
385
|
+
# Post-reheat phase
|
|
386
|
+
reheat_theta = state
|
|
387
|
+
|
|
388
|
+
# Single bit flips with O(n^2)
|
|
389
|
+
if is_opencl:
|
|
390
|
+
theta_buf = make_best_theta_buf(reheat_theta)
|
|
391
|
+
energy, state = run_bit_flips_opencl(False, n_qubits, single_bit_flips_kernel, max_energy, reheat_theta, theta_buf, G_data_buf, G_rows_buf, G_cols_buf, is_segmented, *opencl_args)
|
|
392
|
+
else:
|
|
393
|
+
energy, state = run_single_bit_flips(reheat_theta, is_spin_glass, G_m.data, G_m.indptr, G_m.indices)
|
|
394
|
+
if energy > max_energy:
|
|
395
|
+
max_energy = energy
|
|
396
|
+
best_theta = state
|
|
397
|
+
improved = True
|
|
398
|
+
continue
|
|
399
|
+
|
|
400
|
+
# Double bit flips with O(n^3)
|
|
401
|
+
if is_opencl:
|
|
402
|
+
# theta_buf has not changed
|
|
403
|
+
energy, state = run_bit_flips_opencl(True, n_qubits, double_bit_flips_kernel, max_energy, reheat_theta, theta_buf, G_data_buf, G_rows_buf, G_cols_buf, is_segmented, *opencl_args)
|
|
404
|
+
else:
|
|
405
|
+
energy, state = run_double_bit_flips(reheat_theta, is_spin_glass, G_m.data, G_m.indptr, G_m.indices, thread_count)
|
|
380
406
|
if energy > max_energy:
|
|
381
407
|
max_energy = energy
|
|
382
408
|
best_theta = state
|
|
@@ -132,18 +132,17 @@ def pick_gray_seeds(best_theta, thread_count, gray_seed_multiple, G_func, nodes,
|
|
|
132
132
|
return best_seeds, best_energies
|
|
133
133
|
|
|
134
134
|
@njit(parallel=True)
|
|
135
|
-
def run_gray_optimization(best_theta, iterators, gray_iterations, thread_count, is_spin_glass, G_func, nodes):
|
|
135
|
+
def run_gray_optimization(best_theta, iterators, energies, gray_iterations, thread_count, is_spin_glass, G_func, nodes):
|
|
136
136
|
n = len(best_theta)
|
|
137
137
|
thread_iterations = (gray_iterations + thread_count - 1) // thread_count
|
|
138
138
|
blocks = (n + 63) // 64
|
|
139
139
|
|
|
140
140
|
states = np.empty((thread_count, n), dtype=np.bool_)
|
|
141
|
-
energies = np.full(thread_count, np.finfo(dtype).min, dtype=dtype)
|
|
142
141
|
|
|
143
142
|
if is_spin_glass:
|
|
144
143
|
for i in prange(thread_count):
|
|
145
144
|
iterator = iterators[i].copy()
|
|
146
|
-
best_energy, best_iterator =
|
|
145
|
+
best_energy, best_iterator = energies[i], iterator.copy()
|
|
147
146
|
for curr_idx in range(thread_iterations):
|
|
148
147
|
for block in range(blocks):
|
|
149
148
|
gray_code_next(iterator, curr_idx, block * 64)
|
|
@@ -157,7 +156,7 @@ def run_gray_optimization(best_theta, iterators, gray_iterations, thread_count,
|
|
|
157
156
|
else:
|
|
158
157
|
for i in prange(thread_count):
|
|
159
158
|
iterator = iterators[i].copy()
|
|
160
|
-
best_energy, best_iterator =
|
|
159
|
+
best_energy, best_iterator = energies[i], iterator.copy()
|
|
161
160
|
for curr_idx in range(thread_iterations):
|
|
162
161
|
for block in range(blocks):
|
|
163
162
|
gray_code_next(iterator, curr_idx, block * 64)
|
|
@@ -257,7 +256,26 @@ def spin_glass_solver_streaming(
|
|
|
257
256
|
improved = True
|
|
258
257
|
continue
|
|
259
258
|
|
|
260
|
-
energy, state = run_gray_optimization(best_theta, iterators, gray_iterations, thread_count, is_spin_glass, G_func, nodes)
|
|
259
|
+
energy, state = run_gray_optimization(best_theta, iterators, energies, gray_iterations, thread_count, is_spin_glass, G_func, nodes)
|
|
260
|
+
if energy > max_energy:
|
|
261
|
+
max_energy = energy
|
|
262
|
+
best_theta = state
|
|
263
|
+
improved = True
|
|
264
|
+
continue
|
|
265
|
+
|
|
266
|
+
# Post-reheat phase
|
|
267
|
+
reheat_theta = state
|
|
268
|
+
|
|
269
|
+
# Single bit flips with O(n^2)
|
|
270
|
+
energy, state = run_single_bit_flips(reheat_theta, is_spin_glass, G_func, nodes)
|
|
271
|
+
if energy > max_energy:
|
|
272
|
+
max_energy = energy
|
|
273
|
+
best_theta = state
|
|
274
|
+
improved = True
|
|
275
|
+
continue
|
|
276
|
+
|
|
277
|
+
# Double bit flips with O(n^3)
|
|
278
|
+
energy, state = run_double_bit_flips(reheat_theta, is_spin_glass, G_func, nodes, thread_count)
|
|
261
279
|
if energy > max_energy:
|
|
262
280
|
max_energy = energy
|
|
263
281
|
best_theta = state
|
|
@@ -6,15 +6,15 @@ pyqrackising/maxcut_tfim.py,sha256=U1nNjyfMS48TtTQk7TRf5_VF3pVPfAcZEa2awc2nR8k,1
|
|
|
6
6
|
pyqrackising/maxcut_tfim_sparse.py,sha256=eenJNSEwRvgwACfKoH0tj6rpn7uqH6nNTBuxUPh_lDg,11941
|
|
7
7
|
pyqrackising/maxcut_tfim_streaming.py,sha256=FkBsRoXSRhv4gUeN9O7Ivx54oxq_SqiCDKnYsyxU4bs,6664
|
|
8
8
|
pyqrackising/maxcut_tfim_util.py,sha256=2-tJrBMe7A5hjY-Q1rQKm6PHJfFOgL5WpPGhKndIf_Y,16856
|
|
9
|
-
pyqrackising/spin_glass_solver.py,sha256=
|
|
10
|
-
pyqrackising/spin_glass_solver_sparse.py,sha256=
|
|
11
|
-
pyqrackising/spin_glass_solver_streaming.py,sha256=
|
|
9
|
+
pyqrackising/spin_glass_solver.py,sha256=tgmdJ6b1TetnFM--QEzOZFsNkquQYRVYiHVSzIGYvMI,14207
|
|
10
|
+
pyqrackising/spin_glass_solver_sparse.py,sha256=cmXfAR43n1beRk4LaQbwfrQWkkhMPzPXpdK2T1HhQrk,15159
|
|
11
|
+
pyqrackising/spin_glass_solver_streaming.py,sha256=joQLMKotgjQMwbG0msv_AookiWva_AiVBIR0Xr1Unho,10310
|
|
12
12
|
pyqrackising/tfim_magnetization.py,sha256=On1MhCNGGHRxJFRmCOpMcdqQJiy25gWkjz0Ka8i5f-Q,499
|
|
13
13
|
pyqrackising/tfim_square_magnetization.py,sha256=9uJCT8ytyufcGFrZiignjCkWJr9UcP44sAAy0BIBw34,531
|
|
14
14
|
pyqrackising/tsp.py,sha256=En1Dw66gSi1wit627jI_eKuZMlFNTJU5T3TKZ1R05eE,64231
|
|
15
15
|
pyqrackising/tsp_maxcut.py,sha256=lEDruz5lhjVu0ufvH5VaMJW3_nohO-rEijJJabEtuSU,10084
|
|
16
|
-
pyqrackising-9.2.
|
|
17
|
-
pyqrackising-9.2.
|
|
18
|
-
pyqrackising-9.2.
|
|
19
|
-
pyqrackising-9.2.
|
|
20
|
-
pyqrackising-9.2.
|
|
16
|
+
pyqrackising-9.2.4.dist-info/licenses/LICENSE.md,sha256=fTqV5eBpeAZO0_jit8j4Ref9ikBSlHJ8xwj5TLg7gFk,7817
|
|
17
|
+
pyqrackising-9.2.4.dist-info/METADATA,sha256=k-dQ0Djj0ZaYQzGxYEvU2S7g5WXDPmLDM_mCuxy4B0c,1170
|
|
18
|
+
pyqrackising-9.2.4.dist-info/WHEEL,sha256=ZjXRCNaQ9YSypEK2TE0LRB0sy2OVXSszb4Sx1XjM99k,97
|
|
19
|
+
pyqrackising-9.2.4.dist-info/top_level.txt,sha256=bxlfGuLwzeVEI8Jm5D9HvC_WedgvvkSrpFwbGDjg-Ag,13
|
|
20
|
+
pyqrackising-9.2.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|