PyQrackIsing 9.16.2__tar.gz → 9.16.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.
Files changed (36) hide show
  1. {pyqrackising-9.16.2/pyqrackising.egg-info → pyqrackising-9.16.3}/PKG-INFO +1 -1
  2. {pyqrackising-9.16.2 → pyqrackising-9.16.3}/pyproject.toml +1 -1
  3. {pyqrackising-9.16.2 → pyqrackising-9.16.3}/pyqrackising/generate_tfim_samples.py +43 -6
  4. {pyqrackising-9.16.2 → pyqrackising-9.16.3/pyqrackising.egg-info}/PKG-INFO +1 -1
  5. {pyqrackising-9.16.2 → pyqrackising-9.16.3}/setup.py +1 -1
  6. {pyqrackising-9.16.2 → pyqrackising-9.16.3}/LICENSE.md +0 -0
  7. {pyqrackising-9.16.2 → pyqrackising-9.16.3}/MANIFEST.in +0 -0
  8. {pyqrackising-9.16.2 → pyqrackising-9.16.3}/README.md +0 -0
  9. {pyqrackising-9.16.2 → pyqrackising-9.16.3}/pyqrackising/__init__.py +0 -0
  10. {pyqrackising-9.16.2 → pyqrackising-9.16.3}/pyqrackising/convert_tensor_network_to_tsp.py +0 -0
  11. {pyqrackising-9.16.2 → pyqrackising-9.16.3}/pyqrackising/kernels.cl +0 -0
  12. {pyqrackising-9.16.2 → pyqrackising-9.16.3}/pyqrackising/maxcut_tfim.py +0 -0
  13. {pyqrackising-9.16.2 → pyqrackising-9.16.3}/pyqrackising/maxcut_tfim_sparse.py +0 -0
  14. {pyqrackising-9.16.2 → pyqrackising-9.16.3}/pyqrackising/maxcut_tfim_streaming.py +0 -0
  15. {pyqrackising-9.16.2 → pyqrackising-9.16.3}/pyqrackising/maxcut_tfim_util.py +0 -0
  16. {pyqrackising-9.16.2 → pyqrackising-9.16.3}/pyqrackising/otoc.py +0 -0
  17. {pyqrackising-9.16.2 → pyqrackising-9.16.3}/pyqrackising/solve_maxcut_bnb.py +0 -0
  18. {pyqrackising-9.16.2 → pyqrackising-9.16.3}/pyqrackising/solve_maxcut_bnb_sparse.py +0 -0
  19. {pyqrackising-9.16.2 → pyqrackising-9.16.3}/pyqrackising/solve_maxcut_bnb_streaming.py +0 -0
  20. {pyqrackising-9.16.2 → pyqrackising-9.16.3}/pyqrackising/solve_maxcut_exact.py +0 -0
  21. {pyqrackising-9.16.2 → pyqrackising-9.16.3}/pyqrackising/solve_maxcut_exact_sparse.py +0 -0
  22. {pyqrackising-9.16.2 → pyqrackising-9.16.3}/pyqrackising/solve_maxcut_exact_streaming.py +0 -0
  23. {pyqrackising-9.16.2 → pyqrackising-9.16.3}/pyqrackising/spin_glass_solver.py +0 -0
  24. {pyqrackising-9.16.2 → pyqrackising-9.16.3}/pyqrackising/spin_glass_solver_hybrid.py +0 -0
  25. {pyqrackising-9.16.2 → pyqrackising-9.16.3}/pyqrackising/spin_glass_solver_sparse.py +0 -0
  26. {pyqrackising-9.16.2 → pyqrackising-9.16.3}/pyqrackising/spin_glass_solver_streaming.py +0 -0
  27. {pyqrackising-9.16.2 → pyqrackising-9.16.3}/pyqrackising/tfim_magnetization.py +0 -0
  28. {pyqrackising-9.16.2 → pyqrackising-9.16.3}/pyqrackising/tfim_square_magnetization.py +0 -0
  29. {pyqrackising-9.16.2 → pyqrackising-9.16.3}/pyqrackising/tsp.py +0 -0
  30. {pyqrackising-9.16.2 → pyqrackising-9.16.3}/pyqrackising/tsp_maxcut.py +0 -0
  31. {pyqrackising-9.16.2 → pyqrackising-9.16.3}/pyqrackising.egg-info/SOURCES.txt +0 -0
  32. {pyqrackising-9.16.2 → pyqrackising-9.16.3}/pyqrackising.egg-info/dependency_links.txt +0 -0
  33. {pyqrackising-9.16.2 → pyqrackising-9.16.3}/pyqrackising.egg-info/not-zip-safe +0 -0
  34. {pyqrackising-9.16.2 → pyqrackising-9.16.3}/pyqrackising.egg-info/requires.txt +0 -0
  35. {pyqrackising-9.16.2 → pyqrackising-9.16.3}/pyqrackising.egg-info/top_level.txt +0 -0
  36. {pyqrackising-9.16.2 → pyqrackising-9.16.3}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyqrackising
3
- Version: 9.16.2
3
+ Version: 9.16.3
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.16.2"
10
+ version = "9.16.3"
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"}
@@ -252,11 +252,48 @@ def generate_tfim_samples(J=-1.0, h=2.0, z=4, theta=0.174532925199432957, t=5, n
252
252
  np.random.shuffle(samples)
253
253
  return samples
254
254
 
255
+ # Fermi-Hubbard "v2" completely by (Anthropic) Claude Sonnet 5
256
+
257
+ # "Nice" constants: omega = 4, phi = -3/2, tau = 1/3
258
+ # These are actually a "guess" to move from FITTED to analytical closed-form beta(t)
259
+ omega_b, phi, tau = 4.0, -1.5, (1.0 / 3.0)
260
+ A_peak = 15.0
261
+
262
+ @njit(cache=True)
263
+ def A_of_r(J, h, z):
264
+ r = h / (z * J)
265
+ return A_peak * 4 * abs(r) / (1 + abs(r))**2
266
+
267
+
268
+ @njit(cache=True)
269
+ def beta_formula(t, J, h, z):
270
+ return A_of_r(J, h, z) * np.sin(omega_b * J * t + phi) / (1.0 + (t / tau))
271
+
272
+
273
+ @njit(cache=True)
274
+ def tilt(bias, beta, n_qubits):
275
+ w = bias * np.exp(beta * np.arange(n_qubits + 1))
276
+ return w / w.sum()
277
+
278
+
279
+ def sample_from_bias(bias, shots, n_qubits):
280
+ n_rows, n_cols = factor_width(n_qubits)
281
+ counts = np.random.multinomial(shots, bias)
282
+ samples = []
283
+ samples += [0] * counts[0]
284
+ samples += [(1 << n_qubits) - 1] * counts[-1]
285
+ if n_qubits > 1:
286
+ samples += [int(1 << np.random.randint(n_qubits)) for _ in range(counts[1])]
287
+ if n_qubits > 2:
288
+ mask = (1 << n_qubits) - 1
289
+ samples += [(mask ^ int(1 << np.random.randint(n_qubits))) for _ in range(counts[-2])]
290
+ for hw in range(2, len(bias) - 2):
291
+ samples += sample_fixed_hamming_weight(hw, counts[hw], n_rows, n_cols)
292
+ np.random.shuffle(samples)
293
+ return samples
294
+
255
295
 
256
296
  def generate_fermi_hubbard_samples(J=-1.0, h=2.0, z=4, theta=0.174532925199432957, t=5, n_qubits=56, shots=100, omega=1.5 * np.pi):
257
- shots_x, shots_y, shots_z = np.random.multinomial(shots, [1 / 3, 1 / 3, 1 / 3])
258
- return (
259
- generate_tfim_samples(J=J, h=h, z=z, theta=theta, t=t, n_qubits=n_qubits, shots=shots_z)
260
- + generate_tfim_samples(J=-h, h=-J, z=z, theta=theta + np.pi / 2, t=t, n_qubits=n_qubits, shots=shots_x)
261
- + generate_tfim_samples(J=J, h=h, z=z, theta=theta + np.pi / 2, t=t, n_qubits=n_qubits, shots=shots_y)
262
- )
297
+ z_bias = get_tfim_hamming_distribution(J=J, h=h, z=z, theta=theta, t=t, n_qubits=n_qubits)
298
+ return sample_from_bias(tilt(z_bias, beta_formula(t, J, h, z), n_qubits), shots, n_qubits)
299
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyqrackising
3
- Version: 9.16.2
3
+ Version: 9.16.3
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.16.2",
10
+ version="9.16.3",
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