PyQrackIsing 5.7.4__tar.gz → 6.1.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-5.7.4/pyqrackising.egg-info → pyqrackising-6.1.0}/PKG-INFO +1 -1
- {pyqrackising-5.7.4 → pyqrackising-6.1.0}/README.md +4 -2
- {pyqrackising-5.7.4 → pyqrackising-6.1.0}/pyproject.toml +1 -1
- {pyqrackising-5.7.4 → pyqrackising-6.1.0}/pyqrackising/kernels.cl +175 -147
- {pyqrackising-5.7.4 → pyqrackising-6.1.0}/pyqrackising/maxcut_tfim.py +25 -23
- {pyqrackising-5.7.4 → pyqrackising-6.1.0}/pyqrackising/maxcut_tfim_sparse.py +27 -25
- {pyqrackising-5.7.4 → pyqrackising-6.1.0}/pyqrackising/maxcut_tfim_streaming.py +16 -15
- {pyqrackising-5.7.4 → pyqrackising-6.1.0}/pyqrackising/maxcut_tfim_util.py +50 -14
- {pyqrackising-5.7.4 → pyqrackising-6.1.0}/pyqrackising/spin_glass_solver.py +9 -8
- {pyqrackising-5.7.4 → pyqrackising-6.1.0}/pyqrackising/spin_glass_solver_sparse.py +9 -9
- {pyqrackising-5.7.4 → pyqrackising-6.1.0}/pyqrackising/spin_glass_solver_streaming.py +5 -3
- {pyqrackising-5.7.4 → pyqrackising-6.1.0/pyqrackising.egg-info}/PKG-INFO +1 -1
- {pyqrackising-5.7.4 → pyqrackising-6.1.0}/setup.py +1 -1
- {pyqrackising-5.7.4 → pyqrackising-6.1.0}/CMakeLists.txt +0 -0
- {pyqrackising-5.7.4 → pyqrackising-6.1.0}/LICENSE.md +0 -0
- {pyqrackising-5.7.4 → pyqrackising-6.1.0}/MANIFEST.in +0 -0
- {pyqrackising-5.7.4 → pyqrackising-6.1.0}/pyqrackising/__init__.py +0 -0
- {pyqrackising-5.7.4 → pyqrackising-6.1.0}/pyqrackising/_pyqrack_ising.cpp +0 -0
- {pyqrackising-5.7.4 → pyqrackising-6.1.0}/pyqrackising/generate_tfim_samples.py +0 -0
- {pyqrackising-5.7.4 → pyqrackising-6.1.0}/pyqrackising/spin_glass_solver_util.py +0 -0
- {pyqrackising-5.7.4 → pyqrackising-6.1.0}/pyqrackising/tfim_magnetization.py +0 -0
- {pyqrackising-5.7.4 → pyqrackising-6.1.0}/pyqrackising/tfim_square_magnetization.py +0 -0
- {pyqrackising-5.7.4 → pyqrackising-6.1.0}/pyqrackising/tsp.py +0 -0
- {pyqrackising-5.7.4 → pyqrackising-6.1.0}/pyqrackising.egg-info/SOURCES.txt +0 -0
- {pyqrackising-5.7.4 → pyqrackising-6.1.0}/pyqrackising.egg-info/dependency_links.txt +0 -0
- {pyqrackising-5.7.4 → pyqrackising-6.1.0}/pyqrackising.egg-info/not-zip-safe +0 -0
- {pyqrackising-5.7.4 → pyqrackising-6.1.0}/pyqrackising.egg-info/top_level.txt +0 -0
- {pyqrackising-5.7.4 → pyqrackising-6.1.0}/setup.cfg +0 -0
|
@@ -44,7 +44,7 @@ samples = generate_tfim_samples(
|
|
|
44
44
|
|
|
45
45
|
There are two other functions, `tfim_magnetization()` and `tfim_square_magnetization()`, that follow the same function signature except without the `shots` argument.
|
|
46
46
|
|
|
47
|
-
The library also provides a TFIM-inspired (approximate) MAXCUT solver:
|
|
47
|
+
The library also provides a TFIM-inspired (approximate) MAXCUT solver (which accepts a `networkx` graph or a 32-bit adjacency matrix):
|
|
48
48
|
```py
|
|
49
49
|
from pyqrackising import maxcut_tfim
|
|
50
50
|
import networkx as nx
|
|
@@ -76,7 +76,7 @@ G = generate_spin_glass_graph(n_nodes=64, seed=42)
|
|
|
76
76
|
solution_bit_string, cut_value, node_groups, energy = spin_glass_solver(G, quality=2, best_guess=None, is_base_maxcut_gpu=True, is_alt_gpu_sampling=True, is_combo_maxcut_gpu=True)
|
|
77
77
|
# solution_bit_string, cut_value, node_groups, energy = spin_glass_solver(G, best_guess=maxcut_tfim(G, quality=6)[0])
|
|
78
78
|
```
|
|
79
|
-
We also provide `spin_glass_solver_sparse(G)`, for `scipy` **upper-triangular** CSR sparse arrays (or `networkx` graphs). The (integer) default `quality` setting is `2`. `is_combo_maxcut_gpu` controls whether gradient descent optimization is done on GPU (which is the most costly GPU-based feature), while `is_base_maxcut_gpu` is passed through the underlying `maxcut_tfim(G)` solver. `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)` with passed-through `quality` 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.
|
|
79
|
+
We also provide `spin_glass_solver_sparse(G)`, for `scipy` (32-bit) **upper-triangular** CSR sparse arrays (or `networkx` graphs). The (integer) default `quality` setting is `2`. `is_combo_maxcut_gpu` controls whether gradient descent optimization is done on GPU (which is the most costly GPU-based feature), while `is_base_maxcut_gpu` is passed through the underlying `maxcut_tfim(G)` solver. `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)` with passed-through `quality` 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.
|
|
80
80
|
|
|
81
81
|
From the `spin_glass_solver()`, we provide a (recursive) Traveling Salesman Problem (TSP) solver:
|
|
82
82
|
```py
|
|
@@ -145,6 +145,8 @@ We expose an environment variable, "`PYQRACKISING_MAX_GPU_PROC_ELEM`", for when
|
|
|
145
145
|
|
|
146
146
|
Similarly, for `is_alt_gpu_sampling=True`, define the "top-`n`" count of highest-weight direct neighbors to retain during sampling with environment variable "`PYQRACKISING_GPU_TOP_N`". The default is `32`. Increasing this might increase solution quality, but it will also increase time-to-solution and private memory usage.
|
|
147
147
|
|
|
148
|
+
By default, PyQrackIsing expects all `numpy` floating-point array inputs to be 32-bit. If you'd like to use 64-bit, you can set environment variable `PYQRACKISING_FPPOW=6` (meaning, 2^6=64, for the "floating-point (precision) power"). The default is `5`, for 32-bit. 16-bit is stubbed out and almost compiles for OpenCL, but the bigger hurdle is that `numpy` on `x86_64` doesn't provide a 16-bit floating point implementation. (As author of Qrack, I could suggest to the `numpy` maintainers that open-source, IEEE-compliant software-based implementations exist for `x86_64` and other architectures, but I'm sure they're aware and likely waiting for in-compiler support.) If you're on an ARM-based architecture that isn't using `pyopencl`, there's a good chance 16-bit floating-point will work, if `numpy` uses the native hardware support.
|
|
149
|
+
|
|
148
150
|
## About
|
|
149
151
|
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.
|
|
150
152
|
|
|
@@ -12,7 +12,7 @@ build-backend = "setuptools.build_meta"
|
|
|
12
12
|
|
|
13
13
|
[project]
|
|
14
14
|
name = "pyqrackising"
|
|
15
|
-
version = "
|
|
15
|
+
version = "6.1.0"
|
|
16
16
|
requires-python = ">=3.8"
|
|
17
17
|
description = "Fast MAXCUT, TSP, and sampling heuristics from near-ideal transverse field Ising model (TFIM)"
|
|
18
18
|
readme = {file = "README.txt", content-type = "text/markdown"}
|