PyQrackIsing 9.5.10__tar.gz → 9.5.12__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.10/pyqrackising.egg-info → pyqrackising-9.5.12}/PKG-INFO +1 -1
- {pyqrackising-9.5.10 → pyqrackising-9.5.12}/pyproject.toml +1 -1
- {pyqrackising-9.5.10 → pyqrackising-9.5.12}/pyqrackising/maxcut_tfim_sparse.py +1 -1
- {pyqrackising-9.5.10 → pyqrackising-9.5.12}/pyqrackising/maxcut_tfim_util.py +7 -7
- {pyqrackising-9.5.10 → pyqrackising-9.5.12}/pyqrackising/otoc.py +6 -8
- {pyqrackising-9.5.10 → pyqrackising-9.5.12/pyqrackising.egg-info}/PKG-INFO +1 -1
- {pyqrackising-9.5.10 → pyqrackising-9.5.12}/setup.py +1 -1
- {pyqrackising-9.5.10 → pyqrackising-9.5.12}/LICENSE.md +0 -0
- {pyqrackising-9.5.10 → pyqrackising-9.5.12}/MANIFEST.in +0 -0
- {pyqrackising-9.5.10 → pyqrackising-9.5.12}/README.md +0 -0
- {pyqrackising-9.5.10 → pyqrackising-9.5.12}/pyqrackising/__init__.py +0 -0
- {pyqrackising-9.5.10 → pyqrackising-9.5.12}/pyqrackising/convert_tensor_network_to_tsp.py +0 -0
- {pyqrackising-9.5.10 → pyqrackising-9.5.12}/pyqrackising/generate_tfim_samples.py +0 -0
- {pyqrackising-9.5.10 → pyqrackising-9.5.12}/pyqrackising/kernels.cl +0 -0
- {pyqrackising-9.5.10 → pyqrackising-9.5.12}/pyqrackising/maxcut_tfim.py +0 -0
- {pyqrackising-9.5.10 → pyqrackising-9.5.12}/pyqrackising/maxcut_tfim_streaming.py +0 -0
- {pyqrackising-9.5.10 → pyqrackising-9.5.12}/pyqrackising/spin_glass_solver.py +0 -0
- {pyqrackising-9.5.10 → pyqrackising-9.5.12}/pyqrackising/spin_glass_solver_sparse.py +0 -0
- {pyqrackising-9.5.10 → pyqrackising-9.5.12}/pyqrackising/spin_glass_solver_streaming.py +0 -0
- {pyqrackising-9.5.10 → pyqrackising-9.5.12}/pyqrackising/tfim_magnetization.py +0 -0
- {pyqrackising-9.5.10 → pyqrackising-9.5.12}/pyqrackising/tfim_square_magnetization.py +0 -0
- {pyqrackising-9.5.10 → pyqrackising-9.5.12}/pyqrackising/tsp.py +0 -0
- {pyqrackising-9.5.10 → pyqrackising-9.5.12}/pyqrackising/tsp_maxcut.py +0 -0
- {pyqrackising-9.5.10 → pyqrackising-9.5.12}/pyqrackising.egg-info/SOURCES.txt +0 -0
- {pyqrackising-9.5.10 → pyqrackising-9.5.12}/pyqrackising.egg-info/dependency_links.txt +0 -0
- {pyqrackising-9.5.10 → pyqrackising-9.5.12}/pyqrackising.egg-info/not-zip-safe +0 -0
- {pyqrackising-9.5.10 → pyqrackising-9.5.12}/pyqrackising.egg-info/top_level.txt +0 -0
- {pyqrackising-9.5.10 → pyqrackising-9.5.12}/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.12"
|
|
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"}
|
|
@@ -324,7 +324,7 @@ def maxcut_tfim_sparse(
|
|
|
324
324
|
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
325
|
else:
|
|
326
326
|
thread_count = os.cpu_count() ** 2
|
|
327
|
-
best_solution, best_value = sample_measurement(
|
|
327
|
+
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
328
|
|
|
329
329
|
bit_string, l, r = get_cut(best_solution, nodes, n_qubits)
|
|
330
330
|
|
|
@@ -390,13 +390,13 @@ 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
395
|
tot_prob = 0
|
|
396
|
-
p =
|
|
397
|
-
for q in range(
|
|
398
|
-
thresholds[q
|
|
399
|
-
thresholds[n_bias - q] = p
|
|
396
|
+
p = 1
|
|
397
|
+
for q in range(n_qubits >> 1):
|
|
398
|
+
thresholds[q] = p
|
|
399
|
+
thresholds[n_bias - (q + 1)] = p
|
|
400
400
|
tot_prob += 2 * p
|
|
401
401
|
p = math.comb(n_qubits, q + 1)
|
|
402
402
|
if n_qubits & 1:
|
|
@@ -438,7 +438,7 @@ def probability_by_hamming_weight(J, h, z, theta, t, n_bias, normalized=True):
|
|
|
438
438
|
return bias
|
|
439
439
|
|
|
440
440
|
|
|
441
|
-
@njit
|
|
441
|
+
@njit
|
|
442
442
|
def maxcut_hamming_cdf(hamming_prob, n_qubits, J_func, degrees, quality, tot_t, h_mult):
|
|
443
443
|
n_steps = 1 << quality
|
|
444
444
|
delta_t = tot_t / n_steps
|
|
@@ -446,7 +446,7 @@ def maxcut_hamming_cdf(hamming_prob, n_qubits, J_func, degrees, quality, tot_t,
|
|
|
446
446
|
|
|
447
447
|
theta = init_theta(h_mult, n_qubits, J_func, degrees)
|
|
448
448
|
|
|
449
|
-
for qc in
|
|
449
|
+
for qc in range(n_qubits, n_steps * n_qubits):
|
|
450
450
|
step = qc // n_qubits
|
|
451
451
|
q = qc % n_qubits
|
|
452
452
|
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':
|
|
@@ -141,7 +139,7 @@ def take_sample(n_qubits, sample, m, inv_dist):
|
|
|
141
139
|
return sample
|
|
142
140
|
|
|
143
141
|
|
|
144
|
-
def get_willow_inv_dist(butterfly_idx_x, butterfly_idx_z, n_qubits, row_len, col_len):
|
|
142
|
+
def get_willow_inv_dist(butterfly_idx_x, butterfly_idx_z, n_qubits, row_len, col_len, t):
|
|
145
143
|
inv_dist = np.zeros(n_qubits, dtype=np.float64)
|
|
146
144
|
for idx in butterfly_idx_x:
|
|
147
145
|
b_row, b_col = divmod(idx, row_len)
|
|
@@ -153,12 +151,12 @@ def get_willow_inv_dist(butterfly_idx_x, butterfly_idx_z, n_qubits, row_len, col
|
|
|
153
151
|
for q in range(n_qubits):
|
|
154
152
|
q_row, q_col = divmod(q, row_len)
|
|
155
153
|
inv_dist[q] -= abs(q_row - b_row) + abs(q_col - b_col)
|
|
156
|
-
inv_dist = 2 ** inv_dist
|
|
154
|
+
inv_dist = 2 ** (inv_dist / t)
|
|
157
155
|
|
|
158
156
|
return inv_dist
|
|
159
157
|
|
|
160
158
|
|
|
161
|
-
def get_inv_dist(butterfly_idx_x, butterfly_idx_z, n_qubits, row_len, col_len):
|
|
159
|
+
def get_inv_dist(butterfly_idx_x, butterfly_idx_z, n_qubits, row_len, col_len, t):
|
|
162
160
|
inv_dist = np.zeros(n_qubits, dtype=np.float64)
|
|
163
161
|
half_row = row_len >> 1
|
|
164
162
|
half_col = col_len >> 1
|
|
@@ -184,7 +182,7 @@ def get_inv_dist(butterfly_idx_x, butterfly_idx_z, n_qubits, row_len, col_len):
|
|
|
184
182
|
if col_d > half_col:
|
|
185
183
|
col_d = col_len - col_d
|
|
186
184
|
inv_dist[q] -= row_d + col_d
|
|
187
|
-
inv_dist = 2 ** inv_dist
|
|
185
|
+
inv_dist = 2 ** (inv_dist / t)
|
|
188
186
|
|
|
189
187
|
return inv_dist
|
|
190
188
|
|
|
@@ -200,9 +198,9 @@ def generate_otoc_samples(J=-1.0, h=2.0, z=4, theta=0.0, t=5, n_qubits=65, pauli
|
|
|
200
198
|
butterfly_idx_x = find_all_str_occurrences(pauli_string, 'X')
|
|
201
199
|
butterfly_idx_z = find_all_str_occurrences(pauli_string, 'Z')
|
|
202
200
|
if is_orbifold:
|
|
203
|
-
inv_dist += get_inv_dist(butterfly_idx_x, butterfly_idx_z, n_qubits, row_len, col_len)
|
|
201
|
+
inv_dist += get_inv_dist(butterfly_idx_x, butterfly_idx_z, n_qubits, row_len, col_len, t)
|
|
204
202
|
else:
|
|
205
|
-
inv_dist += get_willow_inv_dist(butterfly_idx_x, butterfly_idx_z, n_qubits, row_len, col_len)
|
|
203
|
+
inv_dist += get_willow_inv_dist(butterfly_idx_x, butterfly_idx_z, n_qubits, row_len, col_len, t)
|
|
206
204
|
inv_dist /= 2.0
|
|
207
205
|
|
|
208
206
|
qubit_pows = [1 << q for q in range(n_qubits)]
|
|
@@ -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.12',
|
|
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
|
|
File without changes
|
|
File without changes
|