PyQrackIsing 9.5.11__tar.gz → 9.5.13__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.5.11/pyqrackising.egg-info → pyqrackising-9.5.13}/PKG-INFO +1 -1
- {pyqrackising-9.5.11 → pyqrackising-9.5.13}/pyproject.toml +1 -1
- {pyqrackising-9.5.11 → pyqrackising-9.5.13}/pyqrackising/maxcut_tfim.py +3 -0
- {pyqrackising-9.5.11 → pyqrackising-9.5.13}/pyqrackising/maxcut_tfim_sparse.py +4 -1
- {pyqrackising-9.5.11 → pyqrackising-9.5.13}/pyqrackising/maxcut_tfim_streaming.py +3 -0
- {pyqrackising-9.5.11 → pyqrackising-9.5.13}/pyqrackising/maxcut_tfim_util.py +14 -12
- {pyqrackising-9.5.11 → pyqrackising-9.5.13}/pyqrackising/otoc.py +0 -2
- {pyqrackising-9.5.11 → pyqrackising-9.5.13/pyqrackising.egg-info}/PKG-INFO +1 -1
- {pyqrackising-9.5.11 → pyqrackising-9.5.13}/setup.py +1 -1
- {pyqrackising-9.5.11 → pyqrackising-9.5.13}/LICENSE.md +0 -0
- {pyqrackising-9.5.11 → pyqrackising-9.5.13}/MANIFEST.in +0 -0
- {pyqrackising-9.5.11 → pyqrackising-9.5.13}/README.md +0 -0
- {pyqrackising-9.5.11 → pyqrackising-9.5.13}/pyqrackising/__init__.py +0 -0
- {pyqrackising-9.5.11 → pyqrackising-9.5.13}/pyqrackising/convert_tensor_network_to_tsp.py +0 -0
- {pyqrackising-9.5.11 → pyqrackising-9.5.13}/pyqrackising/generate_tfim_samples.py +0 -0
- {pyqrackising-9.5.11 → pyqrackising-9.5.13}/pyqrackising/kernels.cl +0 -0
- {pyqrackising-9.5.11 → pyqrackising-9.5.13}/pyqrackising/spin_glass_solver.py +0 -0
- {pyqrackising-9.5.11 → pyqrackising-9.5.13}/pyqrackising/spin_glass_solver_sparse.py +0 -0
- {pyqrackising-9.5.11 → pyqrackising-9.5.13}/pyqrackising/spin_glass_solver_streaming.py +0 -0
- {pyqrackising-9.5.11 → pyqrackising-9.5.13}/pyqrackising/tfim_magnetization.py +0 -0
- {pyqrackising-9.5.11 → pyqrackising-9.5.13}/pyqrackising/tfim_square_magnetization.py +0 -0
- {pyqrackising-9.5.11 → pyqrackising-9.5.13}/pyqrackising/tsp.py +0 -0
- {pyqrackising-9.5.11 → pyqrackising-9.5.13}/pyqrackising/tsp_maxcut.py +0 -0
- {pyqrackising-9.5.11 → pyqrackising-9.5.13}/pyqrackising.egg-info/SOURCES.txt +0 -0
- {pyqrackising-9.5.11 → pyqrackising-9.5.13}/pyqrackising.egg-info/dependency_links.txt +0 -0
- {pyqrackising-9.5.11 → pyqrackising-9.5.13}/pyqrackising.egg-info/not-zip-safe +0 -0
- {pyqrackising-9.5.11 → pyqrackising-9.5.13}/pyqrackising.egg-info/top_level.txt +0 -0
- {pyqrackising-9.5.11 → pyqrackising-9.5.13}/setup.cfg +0 -0
|
@@ -10,7 +10,7 @@ build-backend = "setuptools.build_meta"
|
|
|
10
10
|
|
|
11
11
|
[project]
|
|
12
12
|
name = "pyqrackising"
|
|
13
|
-
version = "9.5.
|
|
13
|
+
version = "9.5.13"
|
|
14
14
|
requires-python = ">=3.8"
|
|
15
15
|
description = "Fast MAXCUT, TSP, and sampling heuristics from near-ideal transverse field Ising model (TFIM)"
|
|
16
16
|
readme = {file = "README.txt", content-type = "text/markdown"}
|
|
@@ -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
|
|
|
@@ -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]
|
|
@@ -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':
|
|
@@ -7,7 +7,7 @@ with open(README_PATH) as readme_file:
|
|
|
7
7
|
|
|
8
8
|
setup(
|
|
9
9
|
name='pyqrackising',
|
|
10
|
-
version='9.5.
|
|
10
|
+
version='9.5.13',
|
|
11
11
|
author='Dan Strano',
|
|
12
12
|
author_email='stranoj@gmail.com',
|
|
13
13
|
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
|