PyQrackIsing 1.6.2__tar.gz → 1.7.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.
- {pyqrackising-1.6.2/PyQrackIsing.egg-info → pyqrackising-1.7.0}/PKG-INFO +1 -1
- {pyqrackising-1.6.2 → pyqrackising-1.7.0}/PyQrackIsing/maxcut_tfim.py +1 -1
- {pyqrackising-1.6.2 → pyqrackising-1.7.0}/PyQrackIsing/spin_glass_solver.py +3 -3
- {pyqrackising-1.6.2 → pyqrackising-1.7.0/PyQrackIsing.egg-info}/PKG-INFO +1 -1
- {pyqrackising-1.6.2 → pyqrackising-1.7.0}/README.md +2 -1
- {pyqrackising-1.6.2 → pyqrackising-1.7.0}/pyproject.toml +1 -1
- {pyqrackising-1.6.2 → pyqrackising-1.7.0}/setup.py +1 -1
- {pyqrackising-1.6.2 → pyqrackising-1.7.0}/CMakeLists.txt +0 -0
- {pyqrackising-1.6.2 → pyqrackising-1.7.0}/LICENSE.md +0 -0
- {pyqrackising-1.6.2 → pyqrackising-1.7.0}/MANIFEST.in +0 -0
- {pyqrackising-1.6.2 → pyqrackising-1.7.0}/PyQrackIsing/__init__.py +0 -0
- {pyqrackising-1.6.2 → pyqrackising-1.7.0}/PyQrackIsing/_pyqrack_ising.cpp +0 -0
- {pyqrackising-1.6.2 → pyqrackising-1.7.0}/PyQrackIsing/generate_tfim_samples.py +0 -0
- {pyqrackising-1.6.2 → pyqrackising-1.7.0}/PyQrackIsing/tfim_magnetization.py +0 -0
- {pyqrackising-1.6.2 → pyqrackising-1.7.0}/PyQrackIsing/tfim_square_magnetization.py +0 -0
- {pyqrackising-1.6.2 → pyqrackising-1.7.0}/PyQrackIsing.egg-info/SOURCES.txt +0 -0
- {pyqrackising-1.6.2 → pyqrackising-1.7.0}/PyQrackIsing.egg-info/dependency_links.txt +0 -0
- {pyqrackising-1.6.2 → pyqrackising-1.7.0}/PyQrackIsing.egg-info/not-zip-safe +0 -0
- {pyqrackising-1.6.2 → pyqrackising-1.7.0}/PyQrackIsing.egg-info/top_level.txt +0 -0
- {pyqrackising-1.6.2 → pyqrackising-1.7.0}/setup.cfg +0 -0
|
@@ -86,7 +86,7 @@ def maxcut_tfim(
|
|
|
86
86
|
# Number of measurement shots
|
|
87
87
|
shots = n_qubits << quality
|
|
88
88
|
|
|
89
|
-
J_eff = np.array([sum(
|
|
89
|
+
J_eff = np.array([-sum(edge_attributes.get('weight', 1.0) for _, edge_attributes in G.adj[i].items()) for i in range(n_qubits)], dtype=np.float64)
|
|
90
90
|
degrees = np.array([sum(abs(edge_attributes.get('weight', 1.0)) for _, edge_attributes in G.adj[i].items()) for i in range(n_qubits)], dtype=np.float64)
|
|
91
91
|
thresholds = tfim_sampler._maxcut_hamming_cdf(J_eff, degrees, quality)
|
|
92
92
|
G_dict = nx.to_dict_of_lists(G)
|
|
@@ -17,7 +17,7 @@ def evaluate_cut_edges(state, G):
|
|
|
17
17
|
def compute_energy(theta_bits, G):
|
|
18
18
|
# Reconstruct Ising energy (note: MAXCUT flips sign!)
|
|
19
19
|
spins = {i: 1 if theta_bits[i] else -1 for i in range(len(theta_bits))}
|
|
20
|
-
energy =
|
|
20
|
+
energy = sum(G[u][v].get("weight", 1) * spins[u] * spins[v] for u, v in G.edges())
|
|
21
21
|
|
|
22
22
|
return energy
|
|
23
23
|
|
|
@@ -33,8 +33,8 @@ def bootstrap_worker(args):
|
|
|
33
33
|
|
|
34
34
|
return indices, energy, flipped
|
|
35
35
|
|
|
36
|
-
def spin_glass_solver(G
|
|
37
|
-
cut_value, bitstring, cut_edges = maxcut_tfim(G, quality)
|
|
36
|
+
def spin_glass_solver(G):
|
|
37
|
+
cut_value, bitstring, cut_edges = maxcut_tfim(G, quality=0)
|
|
38
38
|
best_theta = [ b == '1' for b in list(bitstring)]
|
|
39
39
|
min_energy = compute_energy(best_theta, G)
|
|
40
40
|
n_qubits = len(best_theta)
|
|
@@ -69,8 +69,9 @@ def generate_spin_glass_graph(n_nodes=16, degree=3, seed=None):
|
|
|
69
69
|
|
|
70
70
|
|
|
71
71
|
G = generate_spin_glass_graph(n_nodes=64, seed=42)
|
|
72
|
-
cut_value, bitstring, cut_edges, min_energy = spin_glass_solver(G
|
|
72
|
+
cut_value, bitstring, cut_edges, min_energy = spin_glass_solver(G)
|
|
73
73
|
```
|
|
74
|
+
It is designed with a sign convention for weights such that it can immediately be used as a MAXCUT solver itself: you might need to reverse the sign convention on your weights for spin glass graphs, but this is only convention.
|
|
74
75
|
|
|
75
76
|
## About
|
|
76
77
|
Transverse field Ising model (TFIM) is the basis of most claimed algorithmic "quantum advantage," circa 2025, with the notable exception of Shor's integer factoring algorithm.
|
|
@@ -10,7 +10,7 @@ build-backend = "setuptools.build_meta"
|
|
|
10
10
|
|
|
11
11
|
[project]
|
|
12
12
|
name = "PyQrackIsing"
|
|
13
|
-
version = "1.
|
|
13
|
+
version = "1.7.0"
|
|
14
14
|
requires-python = ">=3.8"
|
|
15
15
|
description = "Near-ideal closed-form solutions for transverse field Ising model (TFIM)"
|
|
16
16
|
readme = {file = "README.txt", content-type = "text/markdown"}
|
|
@@ -51,7 +51,7 @@ ext_modules = [CMakeExtension('tfim_sampler')]
|
|
|
51
51
|
|
|
52
52
|
setup(
|
|
53
53
|
name='PyQrackIsing',
|
|
54
|
-
version='1.
|
|
54
|
+
version='1.7.0',
|
|
55
55
|
author='Dan Strano',
|
|
56
56
|
author_email='stranoj@gmail.com',
|
|
57
57
|
description='Near-ideal closed-form solutions for 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
|