PyQrackIsing 9.16.10__tar.gz → 9.16.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.16.10/pyqrackising.egg-info → pyqrackising-9.16.12}/PKG-INFO +1 -1
- {pyqrackising-9.16.10 → pyqrackising-9.16.12}/pyproject.toml +1 -1
- {pyqrackising-9.16.10 → pyqrackising-9.16.12}/pyqrackising/generate_tfim_samples.py +1 -1
- {pyqrackising-9.16.10 → pyqrackising-9.16.12}/pyqrackising/otoc.py +56 -32
- {pyqrackising-9.16.10 → pyqrackising-9.16.12/pyqrackising.egg-info}/PKG-INFO +1 -1
- {pyqrackising-9.16.10 → pyqrackising-9.16.12}/setup.py +1 -1
- {pyqrackising-9.16.10 → pyqrackising-9.16.12}/LICENSE.md +0 -0
- {pyqrackising-9.16.10 → pyqrackising-9.16.12}/MANIFEST.in +0 -0
- {pyqrackising-9.16.10 → pyqrackising-9.16.12}/README.md +0 -0
- {pyqrackising-9.16.10 → pyqrackising-9.16.12}/pyqrackising/__init__.py +0 -0
- {pyqrackising-9.16.10 → pyqrackising-9.16.12}/pyqrackising/convert_tensor_network_to_tsp.py +0 -0
- {pyqrackising-9.16.10 → pyqrackising-9.16.12}/pyqrackising/kernels.cl +0 -0
- {pyqrackising-9.16.10 → pyqrackising-9.16.12}/pyqrackising/maxcut_tfim.py +0 -0
- {pyqrackising-9.16.10 → pyqrackising-9.16.12}/pyqrackising/maxcut_tfim_sparse.py +0 -0
- {pyqrackising-9.16.10 → pyqrackising-9.16.12}/pyqrackising/maxcut_tfim_streaming.py +0 -0
- {pyqrackising-9.16.10 → pyqrackising-9.16.12}/pyqrackising/maxcut_tfim_util.py +0 -0
- {pyqrackising-9.16.10 → pyqrackising-9.16.12}/pyqrackising/solve_maxcut_bnb.py +0 -0
- {pyqrackising-9.16.10 → pyqrackising-9.16.12}/pyqrackising/solve_maxcut_bnb_sparse.py +0 -0
- {pyqrackising-9.16.10 → pyqrackising-9.16.12}/pyqrackising/solve_maxcut_bnb_streaming.py +0 -0
- {pyqrackising-9.16.10 → pyqrackising-9.16.12}/pyqrackising/solve_maxcut_exact.py +0 -0
- {pyqrackising-9.16.10 → pyqrackising-9.16.12}/pyqrackising/solve_maxcut_exact_sparse.py +0 -0
- {pyqrackising-9.16.10 → pyqrackising-9.16.12}/pyqrackising/solve_maxcut_exact_streaming.py +0 -0
- {pyqrackising-9.16.10 → pyqrackising-9.16.12}/pyqrackising/spin_glass_solver.py +0 -0
- {pyqrackising-9.16.10 → pyqrackising-9.16.12}/pyqrackising/spin_glass_solver_hybrid.py +0 -0
- {pyqrackising-9.16.10 → pyqrackising-9.16.12}/pyqrackising/spin_glass_solver_sparse.py +0 -0
- {pyqrackising-9.16.10 → pyqrackising-9.16.12}/pyqrackising/spin_glass_solver_streaming.py +0 -0
- {pyqrackising-9.16.10 → pyqrackising-9.16.12}/pyqrackising/tfim_magnetization.py +0 -0
- {pyqrackising-9.16.10 → pyqrackising-9.16.12}/pyqrackising/tfim_square_magnetization.py +0 -0
- {pyqrackising-9.16.10 → pyqrackising-9.16.12}/pyqrackising/tsp.py +0 -0
- {pyqrackising-9.16.10 → pyqrackising-9.16.12}/pyqrackising/tsp_maxcut.py +0 -0
- {pyqrackising-9.16.10 → pyqrackising-9.16.12}/pyqrackising.egg-info/SOURCES.txt +0 -0
- {pyqrackising-9.16.10 → pyqrackising-9.16.12}/pyqrackising.egg-info/dependency_links.txt +0 -0
- {pyqrackising-9.16.10 → pyqrackising-9.16.12}/pyqrackising.egg-info/not-zip-safe +0 -0
- {pyqrackising-9.16.10 → pyqrackising-9.16.12}/pyqrackising.egg-info/requires.txt +0 -0
- {pyqrackising-9.16.10 → pyqrackising-9.16.12}/pyqrackising.egg-info/top_level.txt +0 -0
- {pyqrackising-9.16.10 → pyqrackising-9.16.12}/setup.cfg +0 -0
|
@@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"
|
|
|
7
7
|
|
|
8
8
|
[project]
|
|
9
9
|
name = "pyqrackising"
|
|
10
|
-
version = "9.16.
|
|
10
|
+
version = "9.16.12"
|
|
11
11
|
requires-python = ">=3.8"
|
|
12
12
|
description = "Fast MAXCUT, TSP, and sampling heuristics from near-ideal transverse field Ising model (TFIM)"
|
|
13
13
|
readme = {file = "README.txt", content-type = "text/markdown"}
|
|
@@ -212,7 +212,7 @@ def get_tfim_hamming_distribution(J=-1.0, h=2.0, z=4, theta=0.174532925199432957
|
|
|
212
212
|
bias[0] = 1.0
|
|
213
213
|
return bias
|
|
214
214
|
|
|
215
|
-
return probability_by_hamming_weight(J, h, z, theta, t, n_qubits + 1,
|
|
215
|
+
return probability_by_hamming_weight(J, h, z, theta, t, n_qubits + 1, omega=omega)
|
|
216
216
|
|
|
217
217
|
|
|
218
218
|
# ── Public generators ──────────────────────────────────────────────────────────
|
|
@@ -28,7 +28,10 @@ def hadamard(dist):
|
|
|
28
28
|
K_next = ((n - 2 * k_arr) * K_curr - (n - j + 1) * K_prev) / (j + 1)
|
|
29
29
|
result[j + 1] = np.dot(dist, K_next)
|
|
30
30
|
K_prev, K_curr = K_curr, K_next
|
|
31
|
-
|
|
31
|
+
tmp = result / (2 ** n)
|
|
32
|
+
tmp /= tmp.sum()
|
|
33
|
+
|
|
34
|
+
return tmp
|
|
32
35
|
|
|
33
36
|
|
|
34
37
|
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]):
|
|
@@ -38,44 +41,65 @@ def get_otoc_hamming_distribution(J=-1.0, h=2.0, z=4, theta=0.0, t=5, n_qubits=6
|
|
|
38
41
|
bias[0] = 1.0
|
|
39
42
|
return bias
|
|
40
43
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
diff_theta = (rev - fwd) / n_qubits
|
|
44
|
-
|
|
45
|
-
phi = theta + np.pi / 2
|
|
46
|
-
fwd = probability_by_hamming_weight(-h, -J, z, phi, t, n_qubits + 1)
|
|
47
|
-
rev = probability_by_hamming_weight(h, J, z, phi - np.pi, t, n_qubits + 1)
|
|
48
|
-
diff_phi = (rev - fwd) / n_qubits
|
|
44
|
+
# The removed items are identity operation, round-trip.
|
|
45
|
+
pauli_strings = [item for item in pauli_strings if item.count("I") != n_qubits]
|
|
49
46
|
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
signal_frac_x = 0
|
|
48
|
+
signal_frac_z = 0
|
|
52
49
|
|
|
53
50
|
for pauli_string in pauli_strings:
|
|
54
51
|
pauli_string = list(pauli_string)
|
|
55
52
|
if len(pauli_string) != n_qubits:
|
|
56
53
|
raise ValueError("OTOCS pauli_string must be same length as n_qubits! (Use 'I' for qubits that aren't changed.)")
|
|
57
54
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
55
|
+
count_y = pauli_string.count("Y")
|
|
56
|
+
signal_frac_x += pauli_string.count("X") + count_y
|
|
57
|
+
signal_frac_z += pauli_string.count("Z") + count_y
|
|
58
|
+
|
|
59
|
+
x_basis = init_thresholds(n_qubits, theta)
|
|
60
|
+
if signal_frac_x:
|
|
61
|
+
phi = theta + np.pi / 2
|
|
62
|
+
fwd_x = probability_by_hamming_weight(-h, -J, z, phi, t, n_qubits + 1)
|
|
63
|
+
rev = probability_by_hamming_weight(h, J, z, phi - np.pi, t, n_qubits + 1)
|
|
64
|
+
diff_x = rev - fwd_x
|
|
65
|
+
diff_x -= diff_x.mean()
|
|
66
|
+
signal_frac_x /= n_qubits
|
|
67
|
+
fwd_x += signal_frac_x * diff_x
|
|
68
|
+
signal_frac_x /= len(pauli_strings)
|
|
69
|
+
x_basis = (1.0 - signal_frac_x) * x_basis + signal_frac_x * fwd_x
|
|
70
|
+
x_min = x_basis.min()
|
|
71
|
+
x_max = x_basis.max()
|
|
72
|
+
is_norm = False
|
|
73
|
+
if x_min < 0:
|
|
74
|
+
x_basis -= x_min
|
|
75
|
+
is_norm = True
|
|
76
|
+
elif x_max > 1:
|
|
77
|
+
x_basis -= x_max - 1
|
|
78
|
+
is_norm = True
|
|
79
|
+
if is_norm:
|
|
80
|
+
x_basis /= x_basis.sum()
|
|
81
|
+
|
|
82
|
+
z_basis = hadamard(x_basis)
|
|
83
|
+
if signal_frac_z:
|
|
84
|
+
fwd_z = probability_by_hamming_weight(J, h, z, theta, t, n_qubits + 1)
|
|
85
|
+
rev = probability_by_hamming_weight(-J, -h, z, theta + np.pi, t, n_qubits + 1)
|
|
86
|
+
diff_z = rev - fwd_z
|
|
87
|
+
diff_z -= diff_z.mean()
|
|
88
|
+
signal_frac_z /= n_qubits
|
|
89
|
+
fwd_z += signal_frac_z * diff_z
|
|
90
|
+
signal_frac_z /= len(pauli_strings)
|
|
91
|
+
z_basis = (1.0 - signal_frac_z) * z_basis + signal_frac_z * fwd_z
|
|
92
|
+
z_min = z_basis.min()
|
|
93
|
+
z_max = z_basis.max()
|
|
94
|
+
is_norm = False
|
|
95
|
+
if z_min < 0:
|
|
96
|
+
z_basis -= z_min
|
|
97
|
+
is_norm = True
|
|
98
|
+
elif z_max > 1:
|
|
99
|
+
z_basis -= z_max - 1
|
|
100
|
+
is_norm = True
|
|
101
|
+
if is_norm:
|
|
102
|
+
z_basis /= z_basis.sum()
|
|
79
103
|
|
|
80
104
|
return z_basis
|
|
81
105
|
|
|
@@ -7,7 +7,7 @@ with open(README_PATH) as readme_file:
|
|
|
7
7
|
|
|
8
8
|
setup(
|
|
9
9
|
name="pyqrackising",
|
|
10
|
-
version="9.16.
|
|
10
|
+
version="9.16.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
|
|
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
|