PyQrackIsing 5.2.0__tar.gz → 5.2.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.
Files changed (27) hide show
  1. {pyqrackising-5.2.0/pyqrackising.egg-info → pyqrackising-5.2.1}/PKG-INFO +1 -1
  2. {pyqrackising-5.2.0 → pyqrackising-5.2.1}/pyproject.toml +1 -1
  3. {pyqrackising-5.2.0 → pyqrackising-5.2.1}/pyqrackising/maxcut_tfim.py +1 -1
  4. {pyqrackising-5.2.0 → pyqrackising-5.2.1}/pyqrackising/spin_glass_solver.py +3 -3
  5. {pyqrackising-5.2.0 → pyqrackising-5.2.1}/pyqrackising/spin_glass_solver_sparse.py +3 -3
  6. {pyqrackising-5.2.0 → pyqrackising-5.2.1}/pyqrackising/spin_glass_solver_streaming.py +4 -4
  7. {pyqrackising-5.2.0 → pyqrackising-5.2.1/pyqrackising.egg-info}/PKG-INFO +1 -1
  8. {pyqrackising-5.2.0 → pyqrackising-5.2.1}/setup.py +1 -1
  9. {pyqrackising-5.2.0 → pyqrackising-5.2.1}/CMakeLists.txt +0 -0
  10. {pyqrackising-5.2.0 → pyqrackising-5.2.1}/LICENSE.md +0 -0
  11. {pyqrackising-5.2.0 → pyqrackising-5.2.1}/MANIFEST.in +0 -0
  12. {pyqrackising-5.2.0 → pyqrackising-5.2.1}/README.md +0 -0
  13. {pyqrackising-5.2.0 → pyqrackising-5.2.1}/pyqrackising/__init__.py +0 -0
  14. {pyqrackising-5.2.0 → pyqrackising-5.2.1}/pyqrackising/_pyqrack_ising.cpp +0 -0
  15. {pyqrackising-5.2.0 → pyqrackising-5.2.1}/pyqrackising/generate_tfim_samples.py +0 -0
  16. {pyqrackising-5.2.0 → pyqrackising-5.2.1}/pyqrackising/kernels.cl +0 -0
  17. {pyqrackising-5.2.0 → pyqrackising-5.2.1}/pyqrackising/maxcut_tfim_sparse.py +0 -0
  18. {pyqrackising-5.2.0 → pyqrackising-5.2.1}/pyqrackising/maxcut_tfim_streaming.py +0 -0
  19. {pyqrackising-5.2.0 → pyqrackising-5.2.1}/pyqrackising/maxcut_tfim_util.py +0 -0
  20. {pyqrackising-5.2.0 → pyqrackising-5.2.1}/pyqrackising/tfim_magnetization.py +0 -0
  21. {pyqrackising-5.2.0 → pyqrackising-5.2.1}/pyqrackising/tfim_square_magnetization.py +0 -0
  22. {pyqrackising-5.2.0 → pyqrackising-5.2.1}/pyqrackising/tsp.py +0 -0
  23. {pyqrackising-5.2.0 → pyqrackising-5.2.1}/pyqrackising.egg-info/SOURCES.txt +0 -0
  24. {pyqrackising-5.2.0 → pyqrackising-5.2.1}/pyqrackising.egg-info/dependency_links.txt +0 -0
  25. {pyqrackising-5.2.0 → pyqrackising-5.2.1}/pyqrackising.egg-info/not-zip-safe +0 -0
  26. {pyqrackising-5.2.0 → pyqrackising-5.2.1}/pyqrackising.egg-info/top_level.txt +0 -0
  27. {pyqrackising-5.2.0 → pyqrackising-5.2.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyqrackising
3
- Version: 5.2.0
3
+ Version: 5.2.1
4
4
  Summary: Fast MAXCUT, TSP, and sampling heuristics from near-ideal transverse field Ising model (TFIM)
5
5
  Home-page: https://github.com/vm6502q/PyQrackIsing
6
6
  Author: Dan Strano
@@ -12,7 +12,7 @@ build-backend = "setuptools.build_meta"
12
12
 
13
13
  [project]
14
14
  name = "pyqrackising"
15
- version = "5.2.0"
15
+ version = "5.2.1"
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"}
@@ -118,7 +118,7 @@ def init_J_and_z(G_m):
118
118
  J_max = -float("inf")
119
119
  for n in prange(n_qubits):
120
120
  degree = sum(G_m[n] != 0.0)
121
- J = -G_m[n].sum() / degree if degree > 0 else 0
121
+ J = (-G_m[n].sum() / degree) if degree > 0 else 0
122
122
  degrees[n] = degree
123
123
  J_eff[n] = J
124
124
  J_abs = abs(J)
@@ -42,8 +42,8 @@ def bootstrap_worker(theta, G_m, indices):
42
42
 
43
43
  @njit(parallel=True)
44
44
  def bootstrap(theta, G_m, k, indices_array):
45
- n = len(indices_array) // k
46
- energies = np.empty(n, dtype=np.float64)
45
+ n = theta.shape[0]
46
+ energies = np.empty(n, dtype=np.float32)
47
47
  for i in prange(n):
48
48
  j = i * k
49
49
  energies[i] = bootstrap_worker(theta, G_m, indices_array[j : j + k])
@@ -92,7 +92,7 @@ def spin_glass_solver(G, quality=5, shots=None, best_guess=None):
92
92
  bitstring = "".join(["1" if b else "0" for b in best_guess])
93
93
  else:
94
94
  bitstring, _, _ = maxcut_tfim(G_m, quality=quality, shots=shots)
95
- best_theta = [b == "1" for b in list(bitstring)]
95
+ best_theta = np.array([b == "1" for b in list(bitstring)], dtype=np.bool_)
96
96
 
97
97
  min_energy = compute_energy(best_theta, G_m)
98
98
  improved = True
@@ -44,8 +44,8 @@ def bootstrap_worker(theta, G_data, G_rows, G_cols, indices):
44
44
 
45
45
  @njit(parallel=True)
46
46
  def bootstrap(theta, G_data, G_rows, G_cols, k, indices_array):
47
- n = len(indices_array) // k
48
- energies = np.empty(n, dtype=np.float64)
47
+ n = theta.shape[0]
48
+ energies = np.empty(n, dtype=np.float32)
49
49
  for i in prange(n):
50
50
  j = i * k
51
51
  energies[i] = bootstrap_worker(theta, G_data, G_rows, G_cols, indices_array[j : j + k])
@@ -106,7 +106,7 @@ def spin_glass_solver_sparse(G, quality=5, shots=None, best_guess=None):
106
106
  bitstring = "".join(["1" if b else "0" for b in best_guess])
107
107
  else:
108
108
  bitstring, _, _ = maxcut_tfim_sparse(G_m, quality=quality, shots=shots)
109
- best_theta = [b == "1" for b in list(bitstring)]
109
+ best_theta = np.array([b == "1" for b in list(bitstring)], dtype=np.bool_)
110
110
 
111
111
  min_energy = compute_energy(best_theta, G_m.data, G_m.indptr, G_m.indices)
112
112
  improved = True
@@ -42,8 +42,8 @@ def bootstrap_worker(theta, G_func, G_func_args_tuple, nodes, indices):
42
42
 
43
43
  @njit(parallel=True)
44
44
  def bootstrap(theta, G_func, G_func_args_tuple, nodes, k, indices_array):
45
- n = len(indices_array) // k
46
- energies = np.empty(n, dtype=np.float64)
45
+ n = theta.shape[0]
46
+ energies = np.empty(n, dtype=np.float32)
47
47
  for i in prange(n):
48
48
  j = i * k
49
49
  energies[i] = bootstrap_worker(theta, G_func, G_func_args_tuple, nodes, indices_array[j : j + k])
@@ -89,7 +89,7 @@ def spin_glass_solver_streaming(
89
89
  bitstring = "".join(["1" if b else "0" for b in best_guess])
90
90
  else:
91
91
  bitstring, _, _ = maxcut_tfim_streaming(G_func, nodes, G_func_args_tuple=G_func_args_tuple, quality=quality, shots=shots)
92
- best_theta = [b == "1" for b in list(bitstring)]
92
+ best_theta = np.array([b == "1" for b in list(bitstring)], dtype=np.bool_)
93
93
 
94
94
  min_energy = compute_energy(best_theta, G_func, G_func_args_tuple, nodes)
95
95
  improved = True
@@ -106,7 +106,7 @@ def spin_glass_solver_streaming(
106
106
  combos = list(
107
107
  item for sublist in itertools.combinations(range(n_qubits), k) for item in sublist
108
108
  )
109
- energies = bootstrap(theta, G_func, G_func_args_tuple, nodes, k, combos)
109
+ energies = bootstrap(theta, G_m.data, G_m.indptr, G_m.indices, k, combos)
110
110
 
111
111
  energy = energies.min()
112
112
  if energy < min_energy:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyqrackising
3
- Version: 5.2.0
3
+ Version: 5.2.1
4
4
  Summary: Fast MAXCUT, TSP, and sampling heuristics from near-ideal transverse field Ising model (TFIM)
5
5
  Home-page: https://github.com/vm6502q/PyQrackIsing
6
6
  Author: Dan Strano
@@ -51,7 +51,7 @@ ext_modules = [CMakeExtension('tfim_sampler')]
51
51
 
52
52
  setup(
53
53
  name='pyqrackising',
54
- version='5.2.0',
54
+ version='5.2.1',
55
55
  author='Dan Strano',
56
56
  author_email='stranoj@gmail.com',
57
57
  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