pyqrackising 9.4.0__tar.gz → 9.5.0__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.4.0/pyqrackising.egg-info → pyqrackising-9.5.0}/PKG-INFO +1 -1
- {pyqrackising-9.4.0 → pyqrackising-9.5.0}/pyproject.toml +1 -1
- {pyqrackising-9.4.0 → pyqrackising-9.5.0}/pyqrackising/otoc.py +43 -47
- {pyqrackising-9.4.0 → pyqrackising-9.5.0/pyqrackising.egg-info}/PKG-INFO +1 -1
- {pyqrackising-9.4.0 → pyqrackising-9.5.0}/setup.py +1 -1
- {pyqrackising-9.4.0 → pyqrackising-9.5.0}/LICENSE.md +0 -0
- {pyqrackising-9.4.0 → pyqrackising-9.5.0}/MANIFEST.in +0 -0
- {pyqrackising-9.4.0 → pyqrackising-9.5.0}/README.md +0 -0
- {pyqrackising-9.4.0 → pyqrackising-9.5.0}/pyqrackising/__init__.py +0 -0
- {pyqrackising-9.4.0 → pyqrackising-9.5.0}/pyqrackising/convert_tensor_network_to_tsp.py +0 -0
- {pyqrackising-9.4.0 → pyqrackising-9.5.0}/pyqrackising/generate_tfim_samples.py +0 -0
- {pyqrackising-9.4.0 → pyqrackising-9.5.0}/pyqrackising/kernels.cl +0 -0
- {pyqrackising-9.4.0 → pyqrackising-9.5.0}/pyqrackising/maxcut_tfim.py +0 -0
- {pyqrackising-9.4.0 → pyqrackising-9.5.0}/pyqrackising/maxcut_tfim_sparse.py +0 -0
- {pyqrackising-9.4.0 → pyqrackising-9.5.0}/pyqrackising/maxcut_tfim_streaming.py +0 -0
- {pyqrackising-9.4.0 → pyqrackising-9.5.0}/pyqrackising/maxcut_tfim_util.py +0 -0
- {pyqrackising-9.4.0 → pyqrackising-9.5.0}/pyqrackising/spin_glass_solver.py +0 -0
- {pyqrackising-9.4.0 → pyqrackising-9.5.0}/pyqrackising/spin_glass_solver_sparse.py +0 -0
- {pyqrackising-9.4.0 → pyqrackising-9.5.0}/pyqrackising/spin_glass_solver_streaming.py +0 -0
- {pyqrackising-9.4.0 → pyqrackising-9.5.0}/pyqrackising/tfim_magnetization.py +0 -0
- {pyqrackising-9.4.0 → pyqrackising-9.5.0}/pyqrackising/tfim_square_magnetization.py +0 -0
- {pyqrackising-9.4.0 → pyqrackising-9.5.0}/pyqrackising/tsp.py +0 -0
- {pyqrackising-9.4.0 → pyqrackising-9.5.0}/pyqrackising/tsp_maxcut.py +0 -0
- {pyqrackising-9.4.0 → pyqrackising-9.5.0}/pyqrackising.egg-info/SOURCES.txt +0 -0
- {pyqrackising-9.4.0 → pyqrackising-9.5.0}/pyqrackising.egg-info/dependency_links.txt +0 -0
- {pyqrackising-9.4.0 → pyqrackising-9.5.0}/pyqrackising.egg-info/not-zip-safe +0 -0
- {pyqrackising-9.4.0 → pyqrackising-9.5.0}/pyqrackising.egg-info/top_level.txt +0 -0
- {pyqrackising-9.4.0 → pyqrackising-9.5.0}/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.
|
|
13
|
+
version = "9.5.0"
|
|
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"}
|
|
@@ -7,45 +7,44 @@ import sys
|
|
|
7
7
|
epsilon = opencl_context.epsilon
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
def get_otoc_hamming_distribution(J=-1.0, h=2.0, z=4, theta=0.
|
|
11
|
-
pauli_string = list(pauli_string)
|
|
12
|
-
if len(pauli_string) != n_qubits:
|
|
13
|
-
raise ValueError("OTOCS pauli_string must be same length as n_qubits! (Use 'I' for qubits that aren't changed.)")
|
|
14
|
-
|
|
10
|
+
def get_otoc_hamming_distribution(J=-1.0, h=2.0, z=4, theta=0.0, t=5, n_qubits=65, pauli_strings = ['X' + 'I' * 64]):
|
|
15
11
|
n_bias = n_qubits + 1
|
|
16
12
|
if h <= epsilon:
|
|
17
13
|
bias = np.empty(n_bias, dtype=np.float64)
|
|
18
14
|
bias[0] = 1.0
|
|
19
|
-
return
|
|
20
|
-
|
|
21
|
-
fwd = probability_by_hamming_weight(J, h, z, theta, t, n_qubits + 1)
|
|
22
|
-
rev = probability_by_hamming_weight(-J, -h, z, theta + np.pi, t, n_qubits + 1)
|
|
23
|
-
diff_theta = rev - fwd
|
|
24
|
-
|
|
25
|
-
phi = theta + np.pi / 2
|
|
26
|
-
fwd = probability_by_hamming_weight(-h, -J, z, phi, t, n_qubits + 1)
|
|
27
|
-
rev = probability_by_hamming_weight(h, J, z, phi + np.pi, t, n_qubits + 1)
|
|
28
|
-
diff_phi = rev - fwd
|
|
29
|
-
|
|
30
|
-
# Lambda (Y-axis) is at a right angle to both J and h,
|
|
31
|
-
# so there is no difference in this dimension.
|
|
32
|
-
|
|
33
|
-
diff_theta *= cycles
|
|
34
|
-
diff_phi *= cycles
|
|
15
|
+
return bias
|
|
35
16
|
|
|
36
17
|
diff_z = np.zeros(n_bias, dtype=np.float64)
|
|
37
|
-
for
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
18
|
+
for pauli_string in pauli_strings:
|
|
19
|
+
pauli_string = list(pauli_string)
|
|
20
|
+
if len(pauli_string) != n_qubits:
|
|
21
|
+
raise ValueError("OTOCS pauli_string must be same length as n_qubits! (Use 'I' for qubits that aren't changed.)")
|
|
22
|
+
|
|
23
|
+
fwd = probability_by_hamming_weight(J, h, z, theta, t, n_qubits + 1)
|
|
24
|
+
rev = probability_by_hamming_weight(-J, -h, z, theta + np.pi, t, n_qubits + 1)
|
|
25
|
+
diff_theta = rev - fwd
|
|
26
|
+
|
|
27
|
+
phi = theta + np.pi / 2
|
|
28
|
+
fwd = probability_by_hamming_weight(-h, -J, z, phi, t, n_qubits + 1)
|
|
29
|
+
rev = probability_by_hamming_weight(h, J, z, phi + np.pi, t, n_qubits + 1)
|
|
30
|
+
diff_phi = rev - fwd
|
|
31
|
+
|
|
32
|
+
# Lambda (Y-axis) is at a right angle to both J and h,
|
|
33
|
+
# so there is no difference in this dimension.
|
|
34
|
+
|
|
35
|
+
diff_z[0] += n_qubits
|
|
36
|
+
for b in pauli_string:
|
|
37
|
+
match b:
|
|
38
|
+
case 'X':
|
|
39
|
+
diff_z += diff_theta
|
|
40
|
+
case 'Z':
|
|
41
|
+
diff_z += diff_phi
|
|
42
|
+
case 'Y':
|
|
43
|
+
diff_z += diff_theta + diff_phi
|
|
44
|
+
case _:
|
|
45
|
+
pass
|
|
46
|
+
|
|
47
|
+
# Normalize:
|
|
49
48
|
diff_z /= diff_z.sum()
|
|
50
49
|
|
|
51
50
|
return diff_z
|
|
@@ -162,22 +161,19 @@ def get_inv_dist(butterfly_idx_x, butterfly_idx_z, n_qubits, row_len, col_len):
|
|
|
162
161
|
return inv_dist
|
|
163
162
|
|
|
164
163
|
|
|
165
|
-
def generate_otoc_samples(J=-1.0, h=2.0, z=4, theta=0.
|
|
166
|
-
|
|
167
|
-
if len(pauli_string) != n_qubits:
|
|
168
|
-
raise ValueError("OTOC pauli_string must be same length as n_qubits! (Use 'I' for qubits that aren't changed.)")
|
|
169
|
-
|
|
170
|
-
thresholds = fix_cdf(get_otoc_hamming_distribution(J, h, z, theta, t, n_qubits, cycles, pauli_string))
|
|
164
|
+
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):
|
|
165
|
+
thresholds = fix_cdf(get_otoc_hamming_distribution(J, h, z, theta, t, n_qubits, pauli_strings))
|
|
171
166
|
|
|
172
167
|
row_len, col_len = factor_width(n_qubits)
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
168
|
+
inv_dist = np.zeros(n_qubits, dtype=np.float64)
|
|
169
|
+
for pauli_string in pauli_strings:
|
|
170
|
+
butterfly_idx_x = find_all_str_occurrences(pauli_string, 'X')
|
|
171
|
+
butterfly_idx_z = find_all_str_occurrences(pauli_string, 'Z')
|
|
172
|
+
if is_orbifold:
|
|
173
|
+
inv_dist += get_inv_dist(butterfly_idx_x, butterfly_idx_z, n_qubits, row_len, col_len)
|
|
174
|
+
else:
|
|
175
|
+
inv_dist += get_willow_inv_dist(butterfly_idx_x, butterfly_idx_z, n_qubits, row_len, col_len)
|
|
176
|
+
inv_dist /= 2.0
|
|
181
177
|
|
|
182
178
|
samples = []
|
|
183
179
|
for _ in range(shots):
|
|
@@ -7,7 +7,7 @@ with open(README_PATH) as readme_file:
|
|
|
7
7
|
|
|
8
8
|
setup(
|
|
9
9
|
name='pyqrackising',
|
|
10
|
-
version='9.
|
|
10
|
+
version='9.5.0',
|
|
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
|