PyQrackIsing 9.16.9__tar.gz → 9.16.11__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.9/pyqrackising.egg-info → pyqrackising-9.16.11}/PKG-INFO +1 -1
- {pyqrackising-9.16.9 → pyqrackising-9.16.11}/pyproject.toml +1 -1
- {pyqrackising-9.16.9 → pyqrackising-9.16.11}/pyqrackising/generate_tfim_samples.py +1 -1
- {pyqrackising-9.16.9 → pyqrackising-9.16.11}/pyqrackising/maxcut_tfim_util.py +3 -17
- {pyqrackising-9.16.9 → pyqrackising-9.16.11}/pyqrackising/otoc.py +26 -9
- {pyqrackising-9.16.9 → pyqrackising-9.16.11/pyqrackising.egg-info}/PKG-INFO +1 -1
- {pyqrackising-9.16.9 → pyqrackising-9.16.11}/setup.py +1 -1
- {pyqrackising-9.16.9 → pyqrackising-9.16.11}/LICENSE.md +0 -0
- {pyqrackising-9.16.9 → pyqrackising-9.16.11}/MANIFEST.in +0 -0
- {pyqrackising-9.16.9 → pyqrackising-9.16.11}/README.md +0 -0
- {pyqrackising-9.16.9 → pyqrackising-9.16.11}/pyqrackising/__init__.py +0 -0
- {pyqrackising-9.16.9 → pyqrackising-9.16.11}/pyqrackising/convert_tensor_network_to_tsp.py +0 -0
- {pyqrackising-9.16.9 → pyqrackising-9.16.11}/pyqrackising/kernels.cl +0 -0
- {pyqrackising-9.16.9 → pyqrackising-9.16.11}/pyqrackising/maxcut_tfim.py +0 -0
- {pyqrackising-9.16.9 → pyqrackising-9.16.11}/pyqrackising/maxcut_tfim_sparse.py +0 -0
- {pyqrackising-9.16.9 → pyqrackising-9.16.11}/pyqrackising/maxcut_tfim_streaming.py +0 -0
- {pyqrackising-9.16.9 → pyqrackising-9.16.11}/pyqrackising/solve_maxcut_bnb.py +0 -0
- {pyqrackising-9.16.9 → pyqrackising-9.16.11}/pyqrackising/solve_maxcut_bnb_sparse.py +0 -0
- {pyqrackising-9.16.9 → pyqrackising-9.16.11}/pyqrackising/solve_maxcut_bnb_streaming.py +0 -0
- {pyqrackising-9.16.9 → pyqrackising-9.16.11}/pyqrackising/solve_maxcut_exact.py +0 -0
- {pyqrackising-9.16.9 → pyqrackising-9.16.11}/pyqrackising/solve_maxcut_exact_sparse.py +0 -0
- {pyqrackising-9.16.9 → pyqrackising-9.16.11}/pyqrackising/solve_maxcut_exact_streaming.py +0 -0
- {pyqrackising-9.16.9 → pyqrackising-9.16.11}/pyqrackising/spin_glass_solver.py +0 -0
- {pyqrackising-9.16.9 → pyqrackising-9.16.11}/pyqrackising/spin_glass_solver_hybrid.py +0 -0
- {pyqrackising-9.16.9 → pyqrackising-9.16.11}/pyqrackising/spin_glass_solver_sparse.py +0 -0
- {pyqrackising-9.16.9 → pyqrackising-9.16.11}/pyqrackising/spin_glass_solver_streaming.py +0 -0
- {pyqrackising-9.16.9 → pyqrackising-9.16.11}/pyqrackising/tfim_magnetization.py +0 -0
- {pyqrackising-9.16.9 → pyqrackising-9.16.11}/pyqrackising/tfim_square_magnetization.py +0 -0
- {pyqrackising-9.16.9 → pyqrackising-9.16.11}/pyqrackising/tsp.py +0 -0
- {pyqrackising-9.16.9 → pyqrackising-9.16.11}/pyqrackising/tsp_maxcut.py +0 -0
- {pyqrackising-9.16.9 → pyqrackising-9.16.11}/pyqrackising.egg-info/SOURCES.txt +0 -0
- {pyqrackising-9.16.9 → pyqrackising-9.16.11}/pyqrackising.egg-info/dependency_links.txt +0 -0
- {pyqrackising-9.16.9 → pyqrackising-9.16.11}/pyqrackising.egg-info/not-zip-safe +0 -0
- {pyqrackising-9.16.9 → pyqrackising-9.16.11}/pyqrackising.egg-info/requires.txt +0 -0
- {pyqrackising-9.16.9 → pyqrackising-9.16.11}/pyqrackising.egg-info/top_level.txt +0 -0
- {pyqrackising-9.16.9 → pyqrackising-9.16.11}/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.11"
|
|
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 ──────────────────────────────────────────────────────────
|
|
@@ -555,24 +555,10 @@ def init_theta(h_mult, n_qubits, J_eff, degrees):
|
|
|
555
555
|
return theta
|
|
556
556
|
|
|
557
557
|
|
|
558
|
-
def init_thresholds(n_qubits):
|
|
558
|
+
def init_thresholds(n_qubits, theta=0.0):
|
|
559
559
|
n_bias = n_qubits + 1
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
for q in range(n_bias >> 1):
|
|
563
|
-
normalizer += math.comb(n_qubits, q) << 1
|
|
564
|
-
if n_bias & 1:
|
|
565
|
-
normalizer += math.comb(n_qubits, n_qubits >> 1)
|
|
566
|
-
p = 1.0
|
|
567
|
-
for q in range(n_bias >> 1):
|
|
568
|
-
val = p / normalizer
|
|
569
|
-
thresholds[q] = val
|
|
570
|
-
thresholds[n_bias - (q + 1)] = val
|
|
571
|
-
p = math.comb(n_qubits, q + 1)
|
|
572
|
-
if n_bias & 1:
|
|
573
|
-
thresholds[n_qubits >> 1] = p / normalizer
|
|
574
|
-
|
|
575
|
-
return thresholds
|
|
560
|
+
p = (1.0 - np.sin(theta)) / 2.0
|
|
561
|
+
return np.array([math.comb(n_qubits, k) * (p ** k * (1.0 - p) ** (n_qubits - k)) for k in range(n_bias)])
|
|
576
562
|
|
|
577
563
|
|
|
578
564
|
@njit(cache=True)
|
|
@@ -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,17 +41,21 @@ 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
|
-
|
|
44
|
+
pauli_strings = [item for item in pauli_strings if item != (n_qubits * "I")]
|
|
45
|
+
|
|
46
|
+
fwd_z = probability_by_hamming_weight(J, h, z, theta, t, n_qubits + 1)
|
|
42
47
|
rev = probability_by_hamming_weight(-J, -h, z, theta + np.pi, t, n_qubits + 1)
|
|
43
|
-
diff_theta = (rev -
|
|
48
|
+
diff_theta = (rev - fwd_z) / n_qubits
|
|
44
49
|
|
|
45
50
|
phi = theta + np.pi / 2
|
|
46
|
-
|
|
51
|
+
fwd_x = probability_by_hamming_weight(-h, -J, z, phi, t, n_qubits + 1)
|
|
47
52
|
rev = probability_by_hamming_weight(h, J, z, phi - np.pi, t, n_qubits + 1)
|
|
48
|
-
diff_phi = (rev -
|
|
53
|
+
diff_phi = (rev - fwd_x) / n_qubits
|
|
49
54
|
|
|
50
55
|
diff_z = np.zeros(n_bias, dtype=np.float64)
|
|
51
56
|
diff_x = np.zeros(n_bias, dtype=np.float64)
|
|
57
|
+
signal_frac_x = 0
|
|
58
|
+
signal_frac_z = 0
|
|
52
59
|
|
|
53
60
|
for pauli_string in pauli_strings:
|
|
54
61
|
pauli_string = list(pauli_string)
|
|
@@ -59,18 +66,28 @@ def get_otoc_hamming_distribution(J=-1.0, h=2.0, z=4, theta=0.0, t=5, n_qubits=6
|
|
|
59
66
|
match b:
|
|
60
67
|
case "X":
|
|
61
68
|
diff_z += diff_theta
|
|
69
|
+
signal_frac_z += 1
|
|
62
70
|
case "Z":
|
|
63
71
|
diff_x += diff_phi
|
|
72
|
+
signal_frac_x += 1
|
|
64
73
|
case "Y":
|
|
65
74
|
diff_z += diff_theta
|
|
66
75
|
diff_x += diff_phi
|
|
76
|
+
signal_frac_x += 1
|
|
77
|
+
signal_frac_z += 1
|
|
67
78
|
case _:
|
|
68
79
|
pass
|
|
69
80
|
|
|
70
|
-
x_basis = init_thresholds(n_qubits)
|
|
71
|
-
|
|
72
|
-
if
|
|
73
|
-
|
|
81
|
+
x_basis = init_thresholds(n_qubits, theta)
|
|
82
|
+
|
|
83
|
+
if signal_frac_x:
|
|
84
|
+
signal_frac_x /= (n_qubits * len(pauli_strings))
|
|
85
|
+
x_basis = (1.0 - signal_frac_x) * x_basis + signal_frac_x * (fwd_x + diff_x)
|
|
86
|
+
x_min = x_basis.min()
|
|
87
|
+
if x_min < 0:
|
|
88
|
+
x_basis -= x_min
|
|
89
|
+
x_basis /= x_basis.sum()
|
|
90
|
+
|
|
74
91
|
z_basis = hadamard(x_basis) + diff_z
|
|
75
92
|
z_min = z_basis.min()
|
|
76
93
|
if z_min < 0:
|
|
@@ -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.11",
|
|
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
|