PyQrackIsing 8.12.0__tar.gz → 8.13.1__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-8.12.0/pyqrackising.egg-info → pyqrackising-8.13.1}/PKG-INFO +1 -1
- {pyqrackising-8.12.0 → pyqrackising-8.13.1}/pyproject.toml +1 -1
- {pyqrackising-8.12.0 → pyqrackising-8.13.1}/pyqrackising/maxcut_tfim.py +5 -5
- {pyqrackising-8.12.0 → pyqrackising-8.13.1}/pyqrackising/maxcut_tfim_sparse.py +3 -2
- {pyqrackising-8.12.0 → pyqrackising-8.13.1}/pyqrackising/maxcut_tfim_streaming.py +5 -5
- {pyqrackising-8.12.0 → pyqrackising-8.13.1}/pyqrackising/maxcut_tfim_util.py +12 -0
- {pyqrackising-8.12.0 → pyqrackising-8.13.1}/pyqrackising/spin_glass_solver.py +6 -7
- {pyqrackising-8.12.0 → pyqrackising-8.13.1}/pyqrackising/spin_glass_solver_sparse.py +5 -5
- {pyqrackising-8.12.0 → pyqrackising-8.13.1}/pyqrackising/spin_glass_solver_streaming.py +6 -7
- {pyqrackising-8.12.0 → pyqrackising-8.13.1/pyqrackising.egg-info}/PKG-INFO +1 -1
- {pyqrackising-8.12.0 → pyqrackising-8.13.1}/setup.py +1 -1
- {pyqrackising-8.12.0 → pyqrackising-8.13.1}/LICENSE.md +0 -0
- {pyqrackising-8.12.0 → pyqrackising-8.13.1}/MANIFEST.in +0 -0
- {pyqrackising-8.12.0 → pyqrackising-8.13.1}/README.md +0 -0
- {pyqrackising-8.12.0 → pyqrackising-8.13.1}/pyqrackising/__init__.py +0 -0
- {pyqrackising-8.12.0 → pyqrackising-8.13.1}/pyqrackising/convert_tensor_network_to_tsp.py +0 -0
- {pyqrackising-8.12.0 → pyqrackising-8.13.1}/pyqrackising/generate_tfim_samples.py +0 -0
- {pyqrackising-8.12.0 → pyqrackising-8.13.1}/pyqrackising/kernels.cl +0 -0
- {pyqrackising-8.12.0 → pyqrackising-8.13.1}/pyqrackising/spin_glass_solver_util.py +0 -0
- {pyqrackising-8.12.0 → pyqrackising-8.13.1}/pyqrackising/tfim_magnetization.py +0 -0
- {pyqrackising-8.12.0 → pyqrackising-8.13.1}/pyqrackising/tfim_square_magnetization.py +0 -0
- {pyqrackising-8.12.0 → pyqrackising-8.13.1}/pyqrackising/tsp.py +0 -0
- {pyqrackising-8.12.0 → pyqrackising-8.13.1}/pyqrackising/tsp_maxcut.py +0 -0
- {pyqrackising-8.12.0 → pyqrackising-8.13.1}/pyqrackising.egg-info/SOURCES.txt +0 -0
- {pyqrackising-8.12.0 → pyqrackising-8.13.1}/pyqrackising.egg-info/dependency_links.txt +0 -0
- {pyqrackising-8.12.0 → pyqrackising-8.13.1}/pyqrackising.egg-info/not-zip-safe +0 -0
- {pyqrackising-8.12.0 → pyqrackising-8.13.1}/pyqrackising.egg-info/top_level.txt +0 -0
- {pyqrackising-8.12.0 → pyqrackising-8.13.1}/setup.cfg +0 -0
|
@@ -10,7 +10,7 @@ build-backend = "setuptools.build_meta"
|
|
|
10
10
|
|
|
11
11
|
[project]
|
|
12
12
|
name = "pyqrackising"
|
|
13
|
-
version = "8.
|
|
13
|
+
version = "8.13.1"
|
|
14
14
|
requires-python = ">=3.8"
|
|
15
15
|
description = "Fast MAXCUT, TSP, and sampling heuristics from near-ideal transverse field Ising model (TFIM)"
|
|
16
16
|
readme = {file = "README.txt", content-type = "text/markdown"}
|
|
@@ -4,7 +4,7 @@ import numpy as np
|
|
|
4
4
|
import os
|
|
5
5
|
from numba import njit, prange
|
|
6
6
|
|
|
7
|
-
from .maxcut_tfim_util import get_cut, maxcut_hamming_cdf, opencl_context, sample_mag, bit_pick, init_bit_pick
|
|
7
|
+
from .maxcut_tfim_util import get_cut, get_cut_base, maxcut_hamming_cdf, opencl_context, sample_mag, bit_pick, init_bit_pick
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
epsilon = opencl_context.epsilon
|
|
@@ -73,11 +73,11 @@ def compute_energy(sample, G_m, n_qubits):
|
|
|
73
73
|
|
|
74
74
|
@njit
|
|
75
75
|
def compute_cut(sample, G_m, n_qubits):
|
|
76
|
+
l, r = get_cut_base(sample)
|
|
76
77
|
cut = 0
|
|
77
|
-
for u in
|
|
78
|
-
for v in
|
|
79
|
-
|
|
80
|
-
cut += G_m[u, v]
|
|
78
|
+
for u in l:
|
|
79
|
+
for v in r:
|
|
80
|
+
cut += G_m[u, v]
|
|
81
81
|
|
|
82
82
|
return cut
|
|
83
83
|
|
|
@@ -4,7 +4,7 @@ import numpy as np
|
|
|
4
4
|
import os
|
|
5
5
|
from numba import njit, prange
|
|
6
6
|
|
|
7
|
-
from .maxcut_tfim_util import binary_search, get_cut, maxcut_hamming_cdf, opencl_context, sample_mag, bit_pick, init_bit_pick, to_scipy_sparse_upper_triangular
|
|
7
|
+
from .maxcut_tfim_util import binary_search, get_cut, get_cut_base, maxcut_hamming_cdf, opencl_context, sample_mag, bit_pick, init_bit_pick, to_scipy_sparse_upper_triangular
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
epsilon = opencl_context.epsilon
|
|
@@ -83,8 +83,9 @@ def compute_energy(sample, G_data, G_rows, G_cols, n_qubits):
|
|
|
83
83
|
|
|
84
84
|
@njit
|
|
85
85
|
def compute_cut(sample, G_data, G_rows, G_cols, n_qubits):
|
|
86
|
+
l, _ = get_cut_base(sample)
|
|
86
87
|
cut = 0
|
|
87
|
-
for u in
|
|
88
|
+
for u in l:
|
|
88
89
|
for col in range(G_rows[u], G_rows[u + 1]):
|
|
89
90
|
v = G_cols[col]
|
|
90
91
|
if sample[u] != sample[v]:
|
|
@@ -4,7 +4,7 @@ import numpy as np
|
|
|
4
4
|
import os
|
|
5
5
|
from numba import njit, prange
|
|
6
6
|
|
|
7
|
-
from .maxcut_tfim_util import get_cut, maxcut_hamming_cdf, opencl_context, sample_mag, bit_pick, init_bit_pick
|
|
7
|
+
from .maxcut_tfim_util import get_cut, get_cut_base, maxcut_hamming_cdf, opencl_context, sample_mag, bit_pick, init_bit_pick
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
epsilon = opencl_context.epsilon
|
|
@@ -73,11 +73,11 @@ def compute_energy(sample, G_func, nodes, n_qubits):
|
|
|
73
73
|
|
|
74
74
|
@njit
|
|
75
75
|
def compute_cut(sample, G_func, nodes, n_qubits):
|
|
76
|
+
l, r = get_cut_base(sample)
|
|
76
77
|
cut = 0
|
|
77
|
-
for u in
|
|
78
|
-
for v in
|
|
79
|
-
|
|
80
|
-
cut += G_func(nodes[u], nodes[v])
|
|
78
|
+
for u in l:
|
|
79
|
+
for v in r:
|
|
80
|
+
cut += G_func(nodes[u], nodes[v])
|
|
81
81
|
|
|
82
82
|
return cut
|
|
83
83
|
|
|
@@ -120,6 +120,18 @@ def get_cut(solution, nodes):
|
|
|
120
120
|
return bit_string, l, r
|
|
121
121
|
|
|
122
122
|
|
|
123
|
+
@njit
|
|
124
|
+
def get_cut_base(solution):
|
|
125
|
+
l, r = [], []
|
|
126
|
+
for i in range(len(solution)):
|
|
127
|
+
if solution[i]:
|
|
128
|
+
r.append(i)
|
|
129
|
+
else:
|
|
130
|
+
l.append(i)
|
|
131
|
+
|
|
132
|
+
return l, r
|
|
133
|
+
|
|
134
|
+
|
|
123
135
|
@njit
|
|
124
136
|
def binary_search(l, t):
|
|
125
137
|
left = 0
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from .maxcut_tfim import maxcut_tfim
|
|
2
|
-
from .maxcut_tfim_util import opencl_context
|
|
2
|
+
from .maxcut_tfim_util import get_cut_base, opencl_context
|
|
3
3
|
from .spin_glass_solver_util import get_cut_from_bit_array, int_to_bitstring
|
|
4
4
|
import itertools
|
|
5
5
|
import networkx as nx
|
|
@@ -18,12 +18,11 @@ except ImportError:
|
|
|
18
18
|
|
|
19
19
|
@njit
|
|
20
20
|
def evaluate_cut_edges(theta_bits, G_m):
|
|
21
|
-
|
|
21
|
+
l, r = get_cut_base(theta_bits)
|
|
22
22
|
cut = 0
|
|
23
|
-
for u in
|
|
24
|
-
for v in
|
|
25
|
-
|
|
26
|
-
cut += G_m[u, v]
|
|
23
|
+
for u in l:
|
|
24
|
+
for v in r:
|
|
25
|
+
cut += G_m[u, v]
|
|
27
26
|
|
|
28
27
|
return cut
|
|
29
28
|
|
|
@@ -179,7 +178,7 @@ def spin_glass_solver(
|
|
|
179
178
|
anneal_t=None,
|
|
180
179
|
anneal_h=None,
|
|
181
180
|
repulsion_base=None,
|
|
182
|
-
min_order=
|
|
181
|
+
min_order=2,
|
|
183
182
|
max_order=2,
|
|
184
183
|
is_log=False,
|
|
185
184
|
reheat_tries=0
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from .maxcut_tfim_sparse import maxcut_tfim_sparse
|
|
2
|
-
from .maxcut_tfim_util import opencl_context
|
|
2
|
+
from .maxcut_tfim_util import get_cut_base, opencl_context
|
|
3
3
|
from .spin_glass_solver_util import get_cut_from_bit_array, int_to_bitstring
|
|
4
4
|
import itertools
|
|
5
5
|
import networkx as nx
|
|
@@ -19,9 +19,9 @@ except ImportError:
|
|
|
19
19
|
|
|
20
20
|
@njit
|
|
21
21
|
def evaluate_cut_edges(theta_bits, G_data, G_rows, G_cols):
|
|
22
|
-
|
|
23
|
-
cut = 0
|
|
24
|
-
for u in
|
|
22
|
+
l, _ = get_cut_base(theta_bits)
|
|
23
|
+
cut = 0
|
|
24
|
+
for u in l:
|
|
25
25
|
for col in range(G_rows[u], G_rows[u + 1]):
|
|
26
26
|
v = G_cols[col]
|
|
27
27
|
if theta_bits[u] != theta_bits[v]:
|
|
@@ -198,7 +198,7 @@ def spin_glass_solver_sparse(
|
|
|
198
198
|
anneal_t=None,
|
|
199
199
|
anneal_h=None,
|
|
200
200
|
repulsion_base=None,
|
|
201
|
-
min_order=
|
|
201
|
+
min_order=2,
|
|
202
202
|
max_order=2,
|
|
203
203
|
is_log=False,
|
|
204
204
|
reheat_tries=0
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from .maxcut_tfim_streaming import maxcut_tfim_streaming
|
|
2
|
-
from .maxcut_tfim_util import opencl_context
|
|
2
|
+
from .maxcut_tfim_util import get_cut_base, opencl_context
|
|
3
3
|
from .spin_glass_solver_util import get_cut_from_bit_array, int_to_bitstring
|
|
4
4
|
import itertools
|
|
5
5
|
import networkx as nx
|
|
@@ -14,12 +14,11 @@ epsilon = opencl_context.epsilon
|
|
|
14
14
|
|
|
15
15
|
@njit
|
|
16
16
|
def evaluate_cut_edges(theta_bits, G_func, nodes):
|
|
17
|
-
|
|
17
|
+
l, r = get_cut_base(theta_bits)
|
|
18
18
|
cut = 0
|
|
19
|
-
for u in
|
|
20
|
-
for v in
|
|
21
|
-
|
|
22
|
-
cut += G_func(nodes[u], nodes[v])
|
|
19
|
+
for u in l:
|
|
20
|
+
for v in r:
|
|
21
|
+
cut += G_func(nodes[u], nodes[v])
|
|
23
22
|
|
|
24
23
|
return cut
|
|
25
24
|
|
|
@@ -87,7 +86,7 @@ def spin_glass_solver_streaming(
|
|
|
87
86
|
anneal_t=None,
|
|
88
87
|
anneal_h=None,
|
|
89
88
|
repulsion_base=None,
|
|
90
|
-
min_order=
|
|
89
|
+
min_order=2,
|
|
91
90
|
max_order=2,
|
|
92
91
|
is_log=False,
|
|
93
92
|
reheat_tries=0
|
|
@@ -7,7 +7,7 @@ with open(README_PATH) as readme_file:
|
|
|
7
7
|
|
|
8
8
|
setup(
|
|
9
9
|
name='pyqrackising',
|
|
10
|
-
version='8.
|
|
10
|
+
version='8.13.1',
|
|
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
|