pyqrackising 9.5.1__tar.gz → 9.5.3__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.1/pyqrackising.egg-info → pyqrackising-9.5.3}/PKG-INFO +1 -1
- {pyqrackising-9.5.1 → pyqrackising-9.5.3}/pyproject.toml +1 -1
- {pyqrackising-9.5.1 → pyqrackising-9.5.3}/pyqrackising/otoc.py +26 -13
- {pyqrackising-9.5.1 → pyqrackising-9.5.3/pyqrackising.egg-info}/PKG-INFO +1 -1
- {pyqrackising-9.5.1 → pyqrackising-9.5.3}/setup.py +1 -1
- {pyqrackising-9.5.1 → pyqrackising-9.5.3}/LICENSE.md +0 -0
- {pyqrackising-9.5.1 → pyqrackising-9.5.3}/MANIFEST.in +0 -0
- {pyqrackising-9.5.1 → pyqrackising-9.5.3}/README.md +0 -0
- {pyqrackising-9.5.1 → pyqrackising-9.5.3}/pyqrackising/__init__.py +0 -0
- {pyqrackising-9.5.1 → pyqrackising-9.5.3}/pyqrackising/convert_tensor_network_to_tsp.py +0 -0
- {pyqrackising-9.5.1 → pyqrackising-9.5.3}/pyqrackising/generate_tfim_samples.py +0 -0
- {pyqrackising-9.5.1 → pyqrackising-9.5.3}/pyqrackising/kernels.cl +0 -0
- {pyqrackising-9.5.1 → pyqrackising-9.5.3}/pyqrackising/maxcut_tfim.py +0 -0
- {pyqrackising-9.5.1 → pyqrackising-9.5.3}/pyqrackising/maxcut_tfim_sparse.py +0 -0
- {pyqrackising-9.5.1 → pyqrackising-9.5.3}/pyqrackising/maxcut_tfim_streaming.py +0 -0
- {pyqrackising-9.5.1 → pyqrackising-9.5.3}/pyqrackising/maxcut_tfim_util.py +0 -0
- {pyqrackising-9.5.1 → pyqrackising-9.5.3}/pyqrackising/spin_glass_solver.py +0 -0
- {pyqrackising-9.5.1 → pyqrackising-9.5.3}/pyqrackising/spin_glass_solver_sparse.py +0 -0
- {pyqrackising-9.5.1 → pyqrackising-9.5.3}/pyqrackising/spin_glass_solver_streaming.py +0 -0
- {pyqrackising-9.5.1 → pyqrackising-9.5.3}/pyqrackising/tfim_magnetization.py +0 -0
- {pyqrackising-9.5.1 → pyqrackising-9.5.3}/pyqrackising/tfim_square_magnetization.py +0 -0
- {pyqrackising-9.5.1 → pyqrackising-9.5.3}/pyqrackising/tsp.py +0 -0
- {pyqrackising-9.5.1 → pyqrackising-9.5.3}/pyqrackising/tsp_maxcut.py +0 -0
- {pyqrackising-9.5.1 → pyqrackising-9.5.3}/pyqrackising.egg-info/SOURCES.txt +0 -0
- {pyqrackising-9.5.1 → pyqrackising-9.5.3}/pyqrackising.egg-info/dependency_links.txt +0 -0
- {pyqrackising-9.5.1 → pyqrackising-9.5.3}/pyqrackising.egg-info/not-zip-safe +0 -0
- {pyqrackising-9.5.1 → pyqrackising-9.5.3}/pyqrackising.egg-info/top_level.txt +0 -0
- {pyqrackising-9.5.1 → pyqrackising-9.5.3}/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.3"
|
|
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"}
|
|
@@ -43,27 +43,26 @@ def get_otoc_hamming_distribution(J=-1.0, h=2.0, z=4, theta=0.0, t=5, n_qubits=6
|
|
|
43
43
|
rev = probability_by_hamming_weight(h, J, z, phi + np.pi, t, n_qubits + 1)
|
|
44
44
|
diff_phi = rev - fwd
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
diff_lam = diff_theta + diff_phi
|
|
47
|
+
|
|
48
|
+
diff_theta[0] += 1.0
|
|
49
|
+
diff_phi[0] += 1.0
|
|
50
|
+
diff_lam[0] += 1.0
|
|
51
|
+
|
|
52
|
+
diff_theta += max_entropy
|
|
53
|
+
diff_phi += max_entropy
|
|
54
|
+
diff_lam += max_entropy
|
|
48
55
|
|
|
49
|
-
diff_z[0] += n_qubits
|
|
50
|
-
entropy_frac = 0
|
|
51
56
|
for b in pauli_string:
|
|
52
57
|
match b:
|
|
53
58
|
case 'X':
|
|
54
59
|
diff_z += diff_theta
|
|
55
|
-
entropy_frac += 1
|
|
56
60
|
case 'Z':
|
|
57
61
|
diff_z += diff_phi
|
|
58
|
-
entropy_frac += 1
|
|
59
62
|
case 'Y':
|
|
60
|
-
diff_z +=
|
|
61
|
-
entropy_frac += 1
|
|
63
|
+
diff_z += diff_lam
|
|
62
64
|
case _:
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
entropy_frac /= n_qubits
|
|
66
|
-
diff_z = ((1 - entropy_frac) / n_qubits) * diff_z + entropy_frac * max_entropy
|
|
65
|
+
diff_z[0] += 1.0
|
|
67
66
|
|
|
68
67
|
# Normalize:
|
|
69
68
|
diff_z /= diff_z.sum()
|
|
@@ -185,6 +184,12 @@ def get_inv_dist(butterfly_idx_x, butterfly_idx_z, n_qubits, row_len, col_len):
|
|
|
185
184
|
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):
|
|
186
185
|
thresholds = fix_cdf(get_otoc_hamming_distribution(J, h, z, theta, t, n_qubits, pauli_strings))
|
|
187
186
|
|
|
187
|
+
entropy_frac = 0.0
|
|
188
|
+
for pauli_string in pauli_strings:
|
|
189
|
+
pauli_string = list(pauli_string)
|
|
190
|
+
entropy_frac += pauli_string.count('X') + pauli_string.count('Y') + pauli_string.count('Z')
|
|
191
|
+
entropy_frac /= n_qubits * len(pauli_strings)
|
|
192
|
+
|
|
188
193
|
row_len, col_len = factor_width(n_qubits)
|
|
189
194
|
inv_dist = np.zeros(n_qubits, dtype=np.float64)
|
|
190
195
|
for pauli_string in pauli_strings:
|
|
@@ -196,6 +201,7 @@ def generate_otoc_samples(J=-1.0, h=2.0, z=4, theta=0.0, t=5, n_qubits=65, pauli
|
|
|
196
201
|
inv_dist += get_willow_inv_dist(butterfly_idx_x, butterfly_idx_z, n_qubits, row_len, col_len)
|
|
197
202
|
inv_dist /= 2.0
|
|
198
203
|
|
|
204
|
+
qubit_pows = [1 << q for q in range(n_qubits)]
|
|
199
205
|
samples = []
|
|
200
206
|
for _ in range(shots):
|
|
201
207
|
# First dimension: Hamming weight
|
|
@@ -208,6 +214,13 @@ def generate_otoc_samples(J=-1.0, h=2.0, z=4, theta=0.0, t=5, n_qubits=65, pauli
|
|
|
208
214
|
continue
|
|
209
215
|
|
|
210
216
|
# Second dimension: permutation within Hamming weight
|
|
211
|
-
|
|
217
|
+
if np.random.random() < entropy_frac:
|
|
218
|
+
bit_pows = np.random.choice(qubit_pows, size=m, replace=False)
|
|
219
|
+
sample = 0
|
|
220
|
+
for bit_pow in bit_pows:
|
|
221
|
+
sample |= bit_pow
|
|
222
|
+
samples.append(sample)
|
|
223
|
+
else:
|
|
224
|
+
samples.append(take_sample(n_qubits, 0, m, inv_dist))
|
|
212
225
|
|
|
213
226
|
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.3',
|
|
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
|