pyqrackising 9.5.8__tar.gz → 9.5.9__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.
Potentially problematic release.
This version of pyqrackising might be problematic. Click here for more details.
- {pyqrackising-9.5.8/pyqrackising.egg-info → pyqrackising-9.5.9}/PKG-INFO +1 -1
- {pyqrackising-9.5.8 → pyqrackising-9.5.9}/pyproject.toml +1 -1
- {pyqrackising-9.5.8 → pyqrackising-9.5.9}/pyqrackising/otoc.py +14 -21
- {pyqrackising-9.5.8 → pyqrackising-9.5.9/pyqrackising.egg-info}/PKG-INFO +1 -1
- {pyqrackising-9.5.8 → pyqrackising-9.5.9}/setup.py +1 -1
- {pyqrackising-9.5.8 → pyqrackising-9.5.9}/LICENSE.md +0 -0
- {pyqrackising-9.5.8 → pyqrackising-9.5.9}/MANIFEST.in +0 -0
- {pyqrackising-9.5.8 → pyqrackising-9.5.9}/README.md +0 -0
- {pyqrackising-9.5.8 → pyqrackising-9.5.9}/pyqrackising/__init__.py +0 -0
- {pyqrackising-9.5.8 → pyqrackising-9.5.9}/pyqrackising/convert_tensor_network_to_tsp.py +0 -0
- {pyqrackising-9.5.8 → pyqrackising-9.5.9}/pyqrackising/generate_tfim_samples.py +0 -0
- {pyqrackising-9.5.8 → pyqrackising-9.5.9}/pyqrackising/kernels.cl +0 -0
- {pyqrackising-9.5.8 → pyqrackising-9.5.9}/pyqrackising/maxcut_tfim.py +0 -0
- {pyqrackising-9.5.8 → pyqrackising-9.5.9}/pyqrackising/maxcut_tfim_sparse.py +0 -0
- {pyqrackising-9.5.8 → pyqrackising-9.5.9}/pyqrackising/maxcut_tfim_streaming.py +0 -0
- {pyqrackising-9.5.8 → pyqrackising-9.5.9}/pyqrackising/maxcut_tfim_util.py +0 -0
- {pyqrackising-9.5.8 → pyqrackising-9.5.9}/pyqrackising/spin_glass_solver.py +0 -0
- {pyqrackising-9.5.8 → pyqrackising-9.5.9}/pyqrackising/spin_glass_solver_sparse.py +0 -0
- {pyqrackising-9.5.8 → pyqrackising-9.5.9}/pyqrackising/spin_glass_solver_streaming.py +0 -0
- {pyqrackising-9.5.8 → pyqrackising-9.5.9}/pyqrackising/tfim_magnetization.py +0 -0
- {pyqrackising-9.5.8 → pyqrackising-9.5.9}/pyqrackising/tfim_square_magnetization.py +0 -0
- {pyqrackising-9.5.8 → pyqrackising-9.5.9}/pyqrackising/tsp.py +0 -0
- {pyqrackising-9.5.8 → pyqrackising-9.5.9}/pyqrackising/tsp_maxcut.py +0 -0
- {pyqrackising-9.5.8 → pyqrackising-9.5.9}/pyqrackising.egg-info/SOURCES.txt +0 -0
- {pyqrackising-9.5.8 → pyqrackising-9.5.9}/pyqrackising.egg-info/dependency_links.txt +0 -0
- {pyqrackising-9.5.8 → pyqrackising-9.5.9}/pyqrackising.egg-info/not-zip-safe +0 -0
- {pyqrackising-9.5.8 → pyqrackising-9.5.9}/pyqrackising.egg-info/top_level.txt +0 -0
- {pyqrackising-9.5.8 → pyqrackising-9.5.9}/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.9"
|
|
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"}
|
|
@@ -35,7 +35,11 @@ def get_otoc_hamming_distribution(J=-1.0, h=2.0, z=4, theta=0.0, t=5, n_qubits=6
|
|
|
35
35
|
if len(pauli_string) != n_qubits:
|
|
36
36
|
raise ValueError("OTOCS pauli_string must be same length as n_qubits! (Use 'I' for qubits that aren't changed.)")
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
term_signal = 0.5 * pauli_string.count('X') + pauli_string.count('Z') + 1.5 * pauli_string.count('Y')
|
|
39
|
+
if term_signal == 0:
|
|
40
|
+
continue
|
|
41
|
+
|
|
42
|
+
signal_frac -= term_signal
|
|
39
43
|
|
|
40
44
|
fwd = probability_by_hamming_weight(J, h, z, theta, t, n_qubits + 1)
|
|
41
45
|
rev = probability_by_hamming_weight(-J, -h, z, theta + np.pi, t, n_qubits + 1)
|
|
@@ -141,13 +145,13 @@ def get_willow_inv_dist(butterfly_idx_x, butterfly_idx_z, n_qubits, row_len, col
|
|
|
141
145
|
b_row, b_col = divmod(idx, row_len)
|
|
142
146
|
for q in range(n_qubits):
|
|
143
147
|
q_row, q_col = divmod(q, row_len)
|
|
144
|
-
inv_dist[q]
|
|
148
|
+
inv_dist[q] += abs(q_row - b_row) + abs(q_col - b_col)
|
|
145
149
|
for idx in butterfly_idx_z:
|
|
146
150
|
b_row, b_col = divmod(idx, row_len)
|
|
147
151
|
for q in range(n_qubits):
|
|
148
152
|
q_row, q_col = divmod(q, row_len)
|
|
149
|
-
inv_dist[q]
|
|
150
|
-
inv_dist
|
|
153
|
+
inv_dist[q] -= abs(q_row - b_row) + abs(q_col - b_col)
|
|
154
|
+
inv_dist = 2 ** inv_dist
|
|
151
155
|
|
|
152
156
|
return inv_dist
|
|
153
157
|
|
|
@@ -166,7 +170,7 @@ def get_inv_dist(butterfly_idx_x, butterfly_idx_z, n_qubits, row_len, col_len):
|
|
|
166
170
|
col_d = abs(q_col - b_col)
|
|
167
171
|
if col_d > half_col:
|
|
168
172
|
col_d = col_len - col_d
|
|
169
|
-
inv_dist[q]
|
|
173
|
+
inv_dist[q] += row_d + col_d
|
|
170
174
|
for idx in butterfly_idx_z:
|
|
171
175
|
b_row, b_col = divmod(idx, row_len)
|
|
172
176
|
for q in range(n_qubits):
|
|
@@ -177,8 +181,8 @@ def get_inv_dist(butterfly_idx_x, butterfly_idx_z, n_qubits, row_len, col_len):
|
|
|
177
181
|
col_d = abs(q_col - b_col)
|
|
178
182
|
if col_d > half_col:
|
|
179
183
|
col_d = col_len - col_d
|
|
180
|
-
inv_dist[q]
|
|
181
|
-
inv_dist
|
|
184
|
+
inv_dist[q] -= row_d + col_d
|
|
185
|
+
inv_dist = 2 ** inv_dist
|
|
182
186
|
|
|
183
187
|
return inv_dist
|
|
184
188
|
|
|
@@ -186,15 +190,11 @@ def get_inv_dist(butterfly_idx_x, butterfly_idx_z, n_qubits, row_len, col_len):
|
|
|
186
190
|
def generate_otoc_samples(J=-1.0, h=2.0, z=4, theta=0.0, t=5, n_qubits=65, pauli_strings = ['X' + 'I' * 64], shots=100, is_orbifold=True):
|
|
187
191
|
thresholds = fix_cdf(get_otoc_hamming_distribution(J, h, z, theta, t, n_qubits, pauli_strings))
|
|
188
192
|
|
|
189
|
-
signal_frac = 0.0
|
|
190
|
-
for pauli_string in pauli_strings:
|
|
191
|
-
pauli_string = list(pauli_string)
|
|
192
|
-
signal_frac -= 0.5 * pauli_string.count('X') + pauli_string.count('Z') + 1.5 * pauli_string.count('Y')
|
|
193
|
-
signal_frac = 2 ** signal_frac
|
|
194
|
-
|
|
195
193
|
row_len, col_len = factor_width(n_qubits)
|
|
196
194
|
inv_dist = np.zeros(n_qubits, dtype=np.float64)
|
|
197
195
|
for pauli_string in pauli_strings:
|
|
196
|
+
if (pauli_string.count('X') + pauli_string.count('Y') + pauli_string.count('Z')) == 0:
|
|
197
|
+
continue
|
|
198
198
|
butterfly_idx_x = find_all_str_occurrences(pauli_string, 'X')
|
|
199
199
|
butterfly_idx_z = find_all_str_occurrences(pauli_string, 'Z')
|
|
200
200
|
if is_orbifold:
|
|
@@ -216,13 +216,6 @@ def generate_otoc_samples(J=-1.0, h=2.0, z=4, theta=0.0, t=5, n_qubits=65, pauli
|
|
|
216
216
|
continue
|
|
217
217
|
|
|
218
218
|
# Second dimension: permutation within Hamming weight
|
|
219
|
-
|
|
220
|
-
samples.append(take_sample(n_qubits, 0, m, inv_dist))
|
|
221
|
-
else:
|
|
222
|
-
bit_pows = np.random.choice(qubit_pows, size=m, replace=False)
|
|
223
|
-
sample = 0
|
|
224
|
-
for bit_pow in bit_pows:
|
|
225
|
-
sample |= bit_pow
|
|
226
|
-
samples.append(sample)
|
|
219
|
+
samples.append(take_sample(n_qubits, 0, m, inv_dist))
|
|
227
220
|
|
|
228
221
|
return samples
|
|
@@ -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.9',
|
|
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
|
|
File without changes
|
|
File without changes
|