PyQrackIsing 9.11.1__tar.gz → 9.11.2__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 (29) hide show
  1. {pyqrackising-9.11.1/pyqrackising.egg-info → pyqrackising-9.11.2}/PKG-INFO +1 -1
  2. {pyqrackising-9.11.1 → pyqrackising-9.11.2}/pyproject.toml +1 -1
  3. {pyqrackising-9.11.1 → pyqrackising-9.11.2}/pyqrackising/generate_tfim_samples.py +15 -7
  4. {pyqrackising-9.11.1 → pyqrackising-9.11.2/pyqrackising.egg-info}/PKG-INFO +1 -1
  5. {pyqrackising-9.11.1 → pyqrackising-9.11.2}/setup.py +1 -1
  6. {pyqrackising-9.11.1 → pyqrackising-9.11.2}/LICENSE.md +0 -0
  7. {pyqrackising-9.11.1 → pyqrackising-9.11.2}/MANIFEST.in +0 -0
  8. {pyqrackising-9.11.1 → pyqrackising-9.11.2}/README.md +0 -0
  9. {pyqrackising-9.11.1 → pyqrackising-9.11.2}/pyqrackising/__init__.py +0 -0
  10. {pyqrackising-9.11.1 → pyqrackising-9.11.2}/pyqrackising/convert_tensor_network_to_tsp.py +0 -0
  11. {pyqrackising-9.11.1 → pyqrackising-9.11.2}/pyqrackising/kernels.cl +0 -0
  12. {pyqrackising-9.11.1 → pyqrackising-9.11.2}/pyqrackising/maxcut_tfim.py +0 -0
  13. {pyqrackising-9.11.1 → pyqrackising-9.11.2}/pyqrackising/maxcut_tfim_sparse.py +0 -0
  14. {pyqrackising-9.11.1 → pyqrackising-9.11.2}/pyqrackising/maxcut_tfim_streaming.py +0 -0
  15. {pyqrackising-9.11.1 → pyqrackising-9.11.2}/pyqrackising/maxcut_tfim_util.py +0 -0
  16. {pyqrackising-9.11.1 → pyqrackising-9.11.2}/pyqrackising/otoc.py +0 -0
  17. {pyqrackising-9.11.1 → pyqrackising-9.11.2}/pyqrackising/spin_glass_solver.py +0 -0
  18. {pyqrackising-9.11.1 → pyqrackising-9.11.2}/pyqrackising/spin_glass_solver_sparse.py +0 -0
  19. {pyqrackising-9.11.1 → pyqrackising-9.11.2}/pyqrackising/spin_glass_solver_streaming.py +0 -0
  20. {pyqrackising-9.11.1 → pyqrackising-9.11.2}/pyqrackising/tfim_magnetization.py +0 -0
  21. {pyqrackising-9.11.1 → pyqrackising-9.11.2}/pyqrackising/tfim_square_magnetization.py +0 -0
  22. {pyqrackising-9.11.1 → pyqrackising-9.11.2}/pyqrackising/tsp.py +0 -0
  23. {pyqrackising-9.11.1 → pyqrackising-9.11.2}/pyqrackising/tsp_maxcut.py +0 -0
  24. {pyqrackising-9.11.1 → pyqrackising-9.11.2}/pyqrackising.egg-info/SOURCES.txt +0 -0
  25. {pyqrackising-9.11.1 → pyqrackising-9.11.2}/pyqrackising.egg-info/dependency_links.txt +0 -0
  26. {pyqrackising-9.11.1 → pyqrackising-9.11.2}/pyqrackising.egg-info/not-zip-safe +0 -0
  27. {pyqrackising-9.11.1 → pyqrackising-9.11.2}/pyqrackising.egg-info/requires.txt +0 -0
  28. {pyqrackising-9.11.1 → pyqrackising-9.11.2}/pyqrackising.egg-info/top_level.txt +0 -0
  29. {pyqrackising-9.11.1 → pyqrackising-9.11.2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyqrackising
3
- Version: 9.11.1
3
+ Version: 9.11.2
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
@@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"
7
7
 
8
8
  [project]
9
9
  name = "pyqrackising"
10
- version = "9.11.1"
10
+ version = "9.11.2"
11
11
  requires-python = ">=3.8"
12
12
  description = "Fast MAXCUT, TSP, and sampling heuristics from near-ideal transverse field Ising model (TFIM)"
13
13
  readme = {file = "README.txt", content-type = "text/markdown"}
@@ -105,15 +105,17 @@ def sample_fixed_hamming_weight(h_weight, count, n_rows, n_cols, burnin=10):
105
105
 
106
106
  samples = []
107
107
 
108
- total_steps = burnin * count + count
108
+ burn = burnin * n_qubits
109
+ thinning = n_qubits
109
110
 
110
- for step in range(total_steps):
111
+ ones = set([i for i in range(n_qubits) if (state >> i) & 1])
112
+ zeros = set([i for i in range(n_qubits) if not (state >> i) & 1])
113
+
114
+ for step in range(burn + thinning * count):
111
115
  # choose random 1-bit and 0-bit
112
- ones = [i for i in range(n_qubits) if (state >> i) & 1]
113
- zeros = [i for i in range(n_qubits) if not (state >> i) & 1]
114
116
 
115
- i = random.choice(ones)
116
- j = random.choice(zeros)
117
+ i = random.choice(tuple(ones))
118
+ j = random.choice(tuple(zeros))
117
119
 
118
120
  delta = delta_like_edges(state, i, j, neighbors)
119
121
  new_like = like_edges + delta
@@ -122,10 +124,16 @@ def sample_fixed_hamming_weight(h_weight, count, n_rows, n_cols, burnin=10):
122
124
  accept_prob = new_like / like_edges
123
125
  if np.random.random() < accept_prob:
124
126
  state ^= 1 << i
127
+ ones.remove(i)
128
+ zeros.add(i)
129
+
125
130
  state ^= 1 << j
131
+ zeros.remove(j)
132
+ ones.add(j)
133
+
126
134
  like_edges = new_like
127
135
 
128
- if step >= burnin * count:
136
+ if step >= burn and (step - burn) % thinning == 0:
129
137
  samples.append(state)
130
138
 
131
139
  return samples
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyqrackising
3
- Version: 9.11.1
3
+ Version: 9.11.2
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
@@ -7,7 +7,7 @@ with open(README_PATH) as readme_file:
7
7
 
8
8
  setup(
9
9
  name="pyqrackising",
10
- version="9.11.1",
10
+ version="9.11.2",
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