pyqrackising 9.5.11__py3-none-manylinux_2_39_x86_64.whl → 9.7.0__py3-none-manylinux_2_39_x86_64.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/maxcut_tfim.py +3 -0
- pyqrackising/maxcut_tfim_sparse.py +4 -1
- pyqrackising/maxcut_tfim_streaming.py +3 -0
- pyqrackising/maxcut_tfim_util.py +14 -12
- pyqrackising/otoc.py +0 -2
- pyqrackising/spin_glass_solver.py +1 -1
- pyqrackising/spin_glass_solver_sparse.py +1 -1
- pyqrackising/spin_glass_solver_streaming.py +1 -1
- {pyqrackising-9.5.11.dist-info → pyqrackising-9.7.0.dist-info}/METADATA +1 -1
- pyqrackising-9.7.0.dist-info/RECORD +21 -0
- pyqrackising-9.5.11.dist-info/RECORD +0 -21
- {pyqrackising-9.5.11.dist-info → pyqrackising-9.7.0.dist-info}/WHEEL +0 -0
- {pyqrackising-9.5.11.dist-info → pyqrackising-9.7.0.dist-info}/licenses/LICENSE.md +0 -0
- {pyqrackising-9.5.11.dist-info → pyqrackising-9.7.0.dist-info}/top_level.txt +0 -0
pyqrackising/maxcut_tfim.py
CHANGED
|
@@ -22,6 +22,9 @@ def update_repulsion_choice(G_data, G_rows, G_cols, weights, n, used, node, repu
|
|
|
22
22
|
# Select node
|
|
23
23
|
used[node] = True
|
|
24
24
|
|
|
25
|
+
if abs(1.0 - repulsion_base) <= epsilon:
|
|
26
|
+
return
|
|
27
|
+
|
|
25
28
|
# Repulsion: penalize neighbors
|
|
26
29
|
for j in range(G_rows[node], G_rows[node + 1]):
|
|
27
30
|
nbr = G_cols[j]
|
|
@@ -324,7 +327,7 @@ def maxcut_tfim_sparse(
|
|
|
324
327
|
best_solution, best_value = sample_for_opencl(G_m.data, G_m.indptr, G_m.indices, G_data_buf, G_rows_buf, G_cols_buf, shots, cum_prob, repulsion_base, is_spin_glass, is_segmented, segment_size, theta_segment_size)
|
|
325
328
|
else:
|
|
326
329
|
thread_count = os.cpu_count() ** 2
|
|
327
|
-
best_solution, best_value = sample_measurement(
|
|
330
|
+
best_solution, best_value = sample_measurement(G_m.data, G_m.indptr, G_m.indices, shots, thread_count, cum_prob, repulsion_base, is_spin_glass)
|
|
328
331
|
|
|
329
332
|
bit_string, l, r = get_cut(best_solution, nodes, n_qubits)
|
|
330
333
|
|
pyqrackising/maxcut_tfim_util.py
CHANGED
|
@@ -390,19 +390,21 @@ def init_theta(h_mult, n_qubits, J_eff, degrees):
|
|
|
390
390
|
|
|
391
391
|
|
|
392
392
|
def init_thresholds(n_qubits):
|
|
393
|
-
n_bias = n_qubits
|
|
393
|
+
n_bias = n_qubits + 1
|
|
394
394
|
thresholds = np.empty(n_bias, dtype=np.float64)
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
395
|
+
normalizer = 0
|
|
396
|
+
for q in range(n_qubits >> 1):
|
|
397
|
+
normalizer += math.comb(n_qubits, q) << 1
|
|
398
|
+
if n_qubits & 1:
|
|
399
|
+
normalizer += math.comb(n_qubits, n_qubits >> 1)
|
|
400
|
+
p = 1
|
|
401
|
+
for q in range(n_qubits >> 1):
|
|
402
|
+
val = p / normalizer
|
|
403
|
+
thresholds[q] = val
|
|
404
|
+
thresholds[n_bias - (q + 1)] = val
|
|
401
405
|
p = math.comb(n_qubits, q + 1)
|
|
402
406
|
if n_qubits & 1:
|
|
403
|
-
thresholds[n_qubits >> 1] = p
|
|
404
|
-
tot_prob += p
|
|
405
|
-
thresholds /= tot_prob
|
|
407
|
+
thresholds[n_qubits >> 1] = p / normalizer
|
|
406
408
|
|
|
407
409
|
return thresholds
|
|
408
410
|
|
|
@@ -438,7 +440,7 @@ def probability_by_hamming_weight(J, h, z, theta, t, n_bias, normalized=True):
|
|
|
438
440
|
return bias
|
|
439
441
|
|
|
440
442
|
|
|
441
|
-
@njit
|
|
443
|
+
@njit
|
|
442
444
|
def maxcut_hamming_cdf(hamming_prob, n_qubits, J_func, degrees, quality, tot_t, h_mult):
|
|
443
445
|
n_steps = 1 << quality
|
|
444
446
|
delta_t = tot_t / n_steps
|
|
@@ -446,7 +448,7 @@ def maxcut_hamming_cdf(hamming_prob, n_qubits, J_func, degrees, quality, tot_t,
|
|
|
446
448
|
|
|
447
449
|
theta = init_theta(h_mult, n_qubits, J_func, degrees)
|
|
448
450
|
|
|
449
|
-
for qc in
|
|
451
|
+
for qc in range(n_qubits, n_steps * n_qubits):
|
|
450
452
|
step = qc // n_qubits
|
|
451
453
|
q = qc % n_qubits
|
|
452
454
|
J_eff = J_func[q]
|
pyqrackising/otoc.py
CHANGED
|
@@ -51,8 +51,6 @@ def get_otoc_hamming_distribution(J=-1.0, h=2.0, z=4, theta=0.0, t=5, n_qubits=6
|
|
|
51
51
|
rev = probability_by_hamming_weight(h, J, z, phi - np.pi, t, n_qubits + 1)
|
|
52
52
|
diff_phi = rev - fwd
|
|
53
53
|
|
|
54
|
-
diff_lam = (diff_theta + diff_phi) / 2
|
|
55
|
-
|
|
56
54
|
for b in pauli_string:
|
|
57
55
|
match b:
|
|
58
56
|
case 'X':
|
|
@@ -308,7 +308,7 @@ def spin_glass_solver(
|
|
|
308
308
|
best_theta = np.array([b == "1" for b in list(bitstring)], dtype=np.bool_)
|
|
309
309
|
|
|
310
310
|
if gray_iterations is None:
|
|
311
|
-
gray_iterations = n_qubits *
|
|
311
|
+
gray_iterations = n_qubits * n_qubits
|
|
312
312
|
|
|
313
313
|
if gray_seed_multiple is None:
|
|
314
314
|
gray_seed_multiple = os.cpu_count()
|
|
@@ -312,7 +312,7 @@ def spin_glass_solver_sparse(
|
|
|
312
312
|
best_theta = np.array([b == "1" for b in list(bitstring)], dtype=np.bool_)
|
|
313
313
|
|
|
314
314
|
if gray_iterations is None:
|
|
315
|
-
gray_iterations = n_qubits *
|
|
315
|
+
gray_iterations = n_qubits * n_qubits
|
|
316
316
|
|
|
317
317
|
if gray_seed_multiple is None:
|
|
318
318
|
gray_seed_multiple = os.cpu_count()
|
|
@@ -219,7 +219,7 @@ def spin_glass_solver_streaming(
|
|
|
219
219
|
best_theta = np.array([b == "1" for b in list(bitstring)], dtype=np.bool_)
|
|
220
220
|
|
|
221
221
|
if gray_iterations is None:
|
|
222
|
-
gray_iterations = n_qubits *
|
|
222
|
+
gray_iterations = n_qubits * n_qubits
|
|
223
223
|
|
|
224
224
|
if gray_seed_multiple is None:
|
|
225
225
|
gray_seed_multiple = os.cpu_count()
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
pyqrackising/__init__.py,sha256=Q-fHQRApRseeFnnO6VfD1LpjPHCVkWoz0Gnaqmv6lp0,884
|
|
2
|
+
pyqrackising/convert_tensor_network_to_tsp.py,sha256=IbZdPfHQ2bzYqDXUdHfwdZJh-pC8lri_cAgESaskQWI,3450
|
|
3
|
+
pyqrackising/generate_tfim_samples.py,sha256=IlAz1l8oLExO6wJBO8LCQKlU_4ZPlyGsNE8xUt_iTrg,4762
|
|
4
|
+
pyqrackising/kernels.cl,sha256=Q9LZ1oBOZ2A_VsQ8uRUGQKNVpzqVXYwhG6c27FO6ljI,27004
|
|
5
|
+
pyqrackising/maxcut_tfim.py,sha256=uqC7Ryw1ikehGfG4OFV7rHojWlx5u8wL2l8yxsmNkWY,10170
|
|
6
|
+
pyqrackising/maxcut_tfim_sparse.py,sha256=YyenDVmXR46Pf9LClvpNEWjziToE6U7WOy68mKseTkk,11269
|
|
7
|
+
pyqrackising/maxcut_tfim_streaming.py,sha256=7vPKulDRcQ-YvPacCNT11Ba-CXhBYggjpu_aDMov6NE,6410
|
|
8
|
+
pyqrackising/maxcut_tfim_util.py,sha256=Ye8kNEunHQLdbTdyT8hTFlsRy0f3QCnKUDIwZXAm0rM,17003
|
|
9
|
+
pyqrackising/otoc.py,sha256=PKmpjwkGpMmwXGWmeqtvbVj1NfE35i9kkIdjQnDUZKE,7208
|
|
10
|
+
pyqrackising/spin_glass_solver.py,sha256=-hQAyTCRpadYhH4E8cT9kBFK9vdSDNK22XESXGSnfjc,13786
|
|
11
|
+
pyqrackising/spin_glass_solver_sparse.py,sha256=F07Y92FCaUJHX1h1ydTFp6HjWLgo_A2buPErIvtYM7g,14734
|
|
12
|
+
pyqrackising/spin_glass_solver_streaming.py,sha256=dDl7VYeu7BkJlLHTCCovaT3z6-Zx4RGwTVcNGzwxTXY,10012
|
|
13
|
+
pyqrackising/tfim_magnetization.py,sha256=On1MhCNGGHRxJFRmCOpMcdqQJiy25gWkjz0Ka8i5f-Q,499
|
|
14
|
+
pyqrackising/tfim_square_magnetization.py,sha256=9uJCT8ytyufcGFrZiignjCkWJr9UcP44sAAy0BIBw34,531
|
|
15
|
+
pyqrackising/tsp.py,sha256=kqDxU2RCjad-T4tW_C9WO1I-COSwX7fHB6VhIuQsjfQ,62464
|
|
16
|
+
pyqrackising/tsp_maxcut.py,sha256=ngxfSJgePXVwJXfNXYdk4jv1ISznx8zHOqR-Vbf33B0,9772
|
|
17
|
+
pyqrackising-9.7.0.dist-info/licenses/LICENSE.md,sha256=46mU2C5kSwOnkqkw9XQAJlhBL2JAf1_uCD8lVcXyMRg,7652
|
|
18
|
+
pyqrackising-9.7.0.dist-info/METADATA,sha256=OWfrA57TEpL09F0zzFdKL5UmCBTvihkTGF739CIUFcU,1143
|
|
19
|
+
pyqrackising-9.7.0.dist-info/WHEEL,sha256=k8EuOMBHdXsN9XSTE5LrpwS4FtdLkoSlyO_7W-lE_zg,109
|
|
20
|
+
pyqrackising-9.7.0.dist-info/top_level.txt,sha256=bxlfGuLwzeVEI8Jm5D9HvC_WedgvvkSrpFwbGDjg-Ag,13
|
|
21
|
+
pyqrackising-9.7.0.dist-info/RECORD,,
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
pyqrackising/__init__.py,sha256=Q-fHQRApRseeFnnO6VfD1LpjPHCVkWoz0Gnaqmv6lp0,884
|
|
2
|
-
pyqrackising/convert_tensor_network_to_tsp.py,sha256=IbZdPfHQ2bzYqDXUdHfwdZJh-pC8lri_cAgESaskQWI,3450
|
|
3
|
-
pyqrackising/generate_tfim_samples.py,sha256=IlAz1l8oLExO6wJBO8LCQKlU_4ZPlyGsNE8xUt_iTrg,4762
|
|
4
|
-
pyqrackising/kernels.cl,sha256=Q9LZ1oBOZ2A_VsQ8uRUGQKNVpzqVXYwhG6c27FO6ljI,27004
|
|
5
|
-
pyqrackising/maxcut_tfim.py,sha256=05nRjk5hhEjNFjtXdKVObL0cYYuJ8URfcjrOGK5tGi4,10106
|
|
6
|
-
pyqrackising/maxcut_tfim_sparse.py,sha256=zMgaVmEgfZWL2tp728PuEg5Dc_jbQBUPsgbP3lXiMiA,11194
|
|
7
|
-
pyqrackising/maxcut_tfim_streaming.py,sha256=EcRXKurqLiQs6pMNz-rhMp2YQzRXD726RnkXsPt4IJ0,6346
|
|
8
|
-
pyqrackising/maxcut_tfim_util.py,sha256=2FSBcba8Ys8HEe_h-ayB68pAqeeJXeveEHGmZKg_tkI,16889
|
|
9
|
-
pyqrackising/otoc.py,sha256=Vq5tHy-XdV6O5qQGVN8E7xLkwHcXDhlWo6GNJTAd4dE,7258
|
|
10
|
-
pyqrackising/spin_glass_solver.py,sha256=YtsIfYfpwhEMQPVd_sbjqpz6nQcrv8p2mUBYZ-wRpnM,13792
|
|
11
|
-
pyqrackising/spin_glass_solver_sparse.py,sha256=E4Ft7H-uKXZyq1cS7Z77AgdkL5fMlKMK6DwnXgrgOhk,14740
|
|
12
|
-
pyqrackising/spin_glass_solver_streaming.py,sha256=xpWq63yODMzBPQQtpDuB1Tro6ta8pPbVwc0ZkDWVASk,10018
|
|
13
|
-
pyqrackising/tfim_magnetization.py,sha256=On1MhCNGGHRxJFRmCOpMcdqQJiy25gWkjz0Ka8i5f-Q,499
|
|
14
|
-
pyqrackising/tfim_square_magnetization.py,sha256=9uJCT8ytyufcGFrZiignjCkWJr9UcP44sAAy0BIBw34,531
|
|
15
|
-
pyqrackising/tsp.py,sha256=kqDxU2RCjad-T4tW_C9WO1I-COSwX7fHB6VhIuQsjfQ,62464
|
|
16
|
-
pyqrackising/tsp_maxcut.py,sha256=ngxfSJgePXVwJXfNXYdk4jv1ISznx8zHOqR-Vbf33B0,9772
|
|
17
|
-
pyqrackising-9.5.11.dist-info/licenses/LICENSE.md,sha256=46mU2C5kSwOnkqkw9XQAJlhBL2JAf1_uCD8lVcXyMRg,7652
|
|
18
|
-
pyqrackising-9.5.11.dist-info/METADATA,sha256=6Z3r5ubODul2NQjgGyg7M6l_nUBhntcpEI2mU18q81Q,1144
|
|
19
|
-
pyqrackising-9.5.11.dist-info/WHEEL,sha256=k8EuOMBHdXsN9XSTE5LrpwS4FtdLkoSlyO_7W-lE_zg,109
|
|
20
|
-
pyqrackising-9.5.11.dist-info/top_level.txt,sha256=bxlfGuLwzeVEI8Jm5D9HvC_WedgvvkSrpFwbGDjg-Ag,13
|
|
21
|
-
pyqrackising-9.5.11.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|