PyQrackIsing 1.8.1__tar.gz → 1.8.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.
- {pyqrackising-1.8.1/PyQrackIsing.egg-info → pyqrackising-1.8.3}/PKG-INFO +1 -1
- {pyqrackising-1.8.1 → pyqrackising-1.8.3}/PyQrackIsing/spin_glass_solver.py +3 -2
- {pyqrackising-1.8.1 → pyqrackising-1.8.3/PyQrackIsing.egg-info}/PKG-INFO +1 -1
- {pyqrackising-1.8.1 → pyqrackising-1.8.3}/README.md +5 -4
- {pyqrackising-1.8.1 → pyqrackising-1.8.3}/pyproject.toml +1 -1
- {pyqrackising-1.8.1 → pyqrackising-1.8.3}/setup.py +1 -1
- {pyqrackising-1.8.1 → pyqrackising-1.8.3}/CMakeLists.txt +0 -0
- {pyqrackising-1.8.1 → pyqrackising-1.8.3}/LICENSE.md +0 -0
- {pyqrackising-1.8.1 → pyqrackising-1.8.3}/MANIFEST.in +0 -0
- {pyqrackising-1.8.1 → pyqrackising-1.8.3}/PyQrackIsing/__init__.py +0 -0
- {pyqrackising-1.8.1 → pyqrackising-1.8.3}/PyQrackIsing/_pyqrack_ising.cpp +0 -0
- {pyqrackising-1.8.1 → pyqrackising-1.8.3}/PyQrackIsing/generate_tfim_samples.py +0 -0
- {pyqrackising-1.8.1 → pyqrackising-1.8.3}/PyQrackIsing/maxcut_tfim.py +0 -0
- {pyqrackising-1.8.1 → pyqrackising-1.8.3}/PyQrackIsing/tfim_magnetization.py +0 -0
- {pyqrackising-1.8.1 → pyqrackising-1.8.3}/PyQrackIsing/tfim_square_magnetization.py +0 -0
- {pyqrackising-1.8.1 → pyqrackising-1.8.3}/PyQrackIsing.egg-info/SOURCES.txt +0 -0
- {pyqrackising-1.8.1 → pyqrackising-1.8.3}/PyQrackIsing.egg-info/dependency_links.txt +0 -0
- {pyqrackising-1.8.1 → pyqrackising-1.8.3}/PyQrackIsing.egg-info/not-zip-safe +0 -0
- {pyqrackising-1.8.1 → pyqrackising-1.8.3}/PyQrackIsing.egg-info/top_level.txt +0 -0
- {pyqrackising-1.8.1 → pyqrackising-1.8.3}/setup.cfg +0 -0
|
@@ -5,6 +5,7 @@ from numba import njit, prange
|
|
|
5
5
|
import os
|
|
6
6
|
|
|
7
7
|
|
|
8
|
+
@njit
|
|
8
9
|
def evaluate_cut_edges(state, edge_keys, edge_values):
|
|
9
10
|
cut_edges = []
|
|
10
11
|
cut_value = 0
|
|
@@ -63,7 +64,7 @@ def spin_glass_solver(G, quality=2, best_guess=None):
|
|
|
63
64
|
if isinstance(best_guess, str):
|
|
64
65
|
bitstring = best_guess
|
|
65
66
|
elif isinstance(best_guess, int):
|
|
66
|
-
bitstring = int_to_bitstring(best_guess)
|
|
67
|
+
bitstring = int_to_bitstring(best_guess, G.number_of_nodes())
|
|
67
68
|
elif isinstance(best_guess, list):
|
|
68
69
|
bitstring = "".join(["1" if b else "0" for b in best_guess])
|
|
69
70
|
else:
|
|
@@ -111,4 +112,4 @@ def spin_glass_solver(G, quality=2, best_guess=None):
|
|
|
111
112
|
|
|
112
113
|
cut_value, cut_edges = evaluate_cut_edges(sample, edge_keys, edge_values)
|
|
113
114
|
|
|
114
|
-
return cut_value, bitstring, cut_edges, min_energy
|
|
115
|
+
return float(cut_value), bitstring, cut_edges, float(min_energy)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# PyQrack Ising
|
|
2
|
-
Efficiently generate near-ideal samples from transverse field Ising model (TFIM)
|
|
2
|
+
Efficiently generate near-ideal samples from transverse field Ising model (TFIM), and TFIM-inspired MAXCUT solutions
|
|
3
3
|
|
|
4
4
|
(It's "the **Ising** on top.")
|
|
5
5
|
|
|
@@ -68,10 +68,11 @@ def generate_spin_glass_graph(n_nodes=16, degree=3, seed=None):
|
|
|
68
68
|
return G
|
|
69
69
|
|
|
70
70
|
|
|
71
|
-
G = generate_spin_glass_graph(n_nodes=64, seed=42
|
|
72
|
-
cut_value, bitstring, cut_edges,
|
|
71
|
+
G = generate_spin_glass_graph(n_nodes=64, seed=42)
|
|
72
|
+
cut_value, bitstring, cut_edges, energy = spin_glass_solver(G, quality=2, best_guess=None)
|
|
73
|
+
# cut_value, bitstring, cut_edges, energy = spin_glass_solver(G, best_guess=maxcut_tfim(G, quality=12)[1])
|
|
73
74
|
```
|
|
74
|
-
The `quality` setting default is `2`, and overhead grows roughly like the qubit count to the power of `quality` (so `O(n ** 2)` for default). `best_guess` gives the option to seed the algorithm with a best guess as to the maximal cut (as an integer, binary string, or list of booleans). This function 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.
|
|
75
|
+
The `quality` setting default is `2`, and overhead grows roughly like the qubit count to the power of `quality` (so `O(n ** 2)` for default). `best_guess` gives the option to seed the algorithm with a best guess as to the maximal cut (as an integer, binary string, or list of booleans). By default, `spin_glass_solver()` uses `maxcut_tfim(G, quality=0)` as `best_guess`, which typically works well, but it could be seeded with higher `maxcut_tfim()` `quality` or Goemans-Williamson, for example. This function 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.
|
|
75
76
|
|
|
76
77
|
## About
|
|
77
78
|
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.
|
|
@@ -11,7 +11,7 @@ build-backend = "setuptools.build_meta"
|
|
|
11
11
|
|
|
12
12
|
[project]
|
|
13
13
|
name = "PyQrackIsing"
|
|
14
|
-
version = "1.8.
|
|
14
|
+
version = "1.8.3"
|
|
15
15
|
requires-python = ">=3.8"
|
|
16
16
|
description = "Near-ideal closed-form solutions for transverse field Ising model (TFIM)"
|
|
17
17
|
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.8.
|
|
54
|
+
version='1.8.3',
|
|
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
|
|
File without changes
|