PyQrackIsing 9.16.3__tar.gz → 9.16.5__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-9.16.3/pyqrackising.egg-info → pyqrackising-9.16.5}/PKG-INFO +1 -1
- {pyqrackising-9.16.3 → pyqrackising-9.16.5}/pyproject.toml +1 -1
- {pyqrackising-9.16.3 → pyqrackising-9.16.5}/pyqrackising/generate_tfim_samples.py +64 -11
- {pyqrackising-9.16.3 → pyqrackising-9.16.5/pyqrackising.egg-info}/PKG-INFO +1 -1
- {pyqrackising-9.16.3 → pyqrackising-9.16.5}/setup.py +1 -1
- {pyqrackising-9.16.3 → pyqrackising-9.16.5}/LICENSE.md +0 -0
- {pyqrackising-9.16.3 → pyqrackising-9.16.5}/MANIFEST.in +0 -0
- {pyqrackising-9.16.3 → pyqrackising-9.16.5}/README.md +0 -0
- {pyqrackising-9.16.3 → pyqrackising-9.16.5}/pyqrackising/__init__.py +0 -0
- {pyqrackising-9.16.3 → pyqrackising-9.16.5}/pyqrackising/convert_tensor_network_to_tsp.py +0 -0
- {pyqrackising-9.16.3 → pyqrackising-9.16.5}/pyqrackising/kernels.cl +0 -0
- {pyqrackising-9.16.3 → pyqrackising-9.16.5}/pyqrackising/maxcut_tfim.py +0 -0
- {pyqrackising-9.16.3 → pyqrackising-9.16.5}/pyqrackising/maxcut_tfim_sparse.py +0 -0
- {pyqrackising-9.16.3 → pyqrackising-9.16.5}/pyqrackising/maxcut_tfim_streaming.py +0 -0
- {pyqrackising-9.16.3 → pyqrackising-9.16.5}/pyqrackising/maxcut_tfim_util.py +0 -0
- {pyqrackising-9.16.3 → pyqrackising-9.16.5}/pyqrackising/otoc.py +0 -0
- {pyqrackising-9.16.3 → pyqrackising-9.16.5}/pyqrackising/solve_maxcut_bnb.py +0 -0
- {pyqrackising-9.16.3 → pyqrackising-9.16.5}/pyqrackising/solve_maxcut_bnb_sparse.py +0 -0
- {pyqrackising-9.16.3 → pyqrackising-9.16.5}/pyqrackising/solve_maxcut_bnb_streaming.py +0 -0
- {pyqrackising-9.16.3 → pyqrackising-9.16.5}/pyqrackising/solve_maxcut_exact.py +0 -0
- {pyqrackising-9.16.3 → pyqrackising-9.16.5}/pyqrackising/solve_maxcut_exact_sparse.py +0 -0
- {pyqrackising-9.16.3 → pyqrackising-9.16.5}/pyqrackising/solve_maxcut_exact_streaming.py +0 -0
- {pyqrackising-9.16.3 → pyqrackising-9.16.5}/pyqrackising/spin_glass_solver.py +0 -0
- {pyqrackising-9.16.3 → pyqrackising-9.16.5}/pyqrackising/spin_glass_solver_hybrid.py +0 -0
- {pyqrackising-9.16.3 → pyqrackising-9.16.5}/pyqrackising/spin_glass_solver_sparse.py +0 -0
- {pyqrackising-9.16.3 → pyqrackising-9.16.5}/pyqrackising/spin_glass_solver_streaming.py +0 -0
- {pyqrackising-9.16.3 → pyqrackising-9.16.5}/pyqrackising/tfim_magnetization.py +0 -0
- {pyqrackising-9.16.3 → pyqrackising-9.16.5}/pyqrackising/tfim_square_magnetization.py +0 -0
- {pyqrackising-9.16.3 → pyqrackising-9.16.5}/pyqrackising/tsp.py +0 -0
- {pyqrackising-9.16.3 → pyqrackising-9.16.5}/pyqrackising/tsp_maxcut.py +0 -0
- {pyqrackising-9.16.3 → pyqrackising-9.16.5}/pyqrackising.egg-info/SOURCES.txt +0 -0
- {pyqrackising-9.16.3 → pyqrackising-9.16.5}/pyqrackising.egg-info/dependency_links.txt +0 -0
- {pyqrackising-9.16.3 → pyqrackising-9.16.5}/pyqrackising.egg-info/not-zip-safe +0 -0
- {pyqrackising-9.16.3 → pyqrackising-9.16.5}/pyqrackising.egg-info/requires.txt +0 -0
- {pyqrackising-9.16.3 → pyqrackising-9.16.5}/pyqrackising.egg-info/top_level.txt +0 -0
- {pyqrackising-9.16.3 → pyqrackising-9.16.5}/setup.cfg +0 -0
|
@@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"
|
|
|
7
7
|
|
|
8
8
|
[project]
|
|
9
9
|
name = "pyqrackising"
|
|
10
|
-
version = "9.16.
|
|
10
|
+
version = "9.16.5"
|
|
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,22 +252,66 @@ 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
|
|
255
|
+
# Fermi-Hubbard correction, by (Anthropic) Claude Sonnet 5, per D. Strano's
|
|
256
|
+
# direction on the final functional form.
|
|
257
|
+
#
|
|
258
|
+
# beta(t) = A * cos(omega(h,J) * J * t + theta) / (1 + sqrt(t))
|
|
259
|
+
#
|
|
260
|
+
# STRUCTURAL PRINCIPLE (D. Strano): this reuses the EXACT decay envelope
|
|
261
|
+
# (1/(1+sqrt(t))) and phase convention (cos(...+theta), where theta is the
|
|
262
|
+
# same state-prep angle already passed into every call, not a free-fit
|
|
263
|
+
# parameter) from the base TFIM ansatz's own p(t) formula above. The
|
|
264
|
+
# rationale for preferring this over a numerically-tuned decay exponent
|
|
265
|
+
# (informally fit to ~1.29 across the same small sweep used to validate
|
|
266
|
+
# this file) is that sqrt(t) is not tuned to this sweep at all -- it's
|
|
267
|
+
# borrowed from a form already validated at scale elsewhere in this
|
|
268
|
+
# codebase, so it carries evidence beyond this file's own small validation
|
|
269
|
+
# set, where a locally-tuned exponent risks just re-overfitting the same
|
|
270
|
+
# way A_peak's old bump-in-r formula did.
|
|
271
|
+
#
|
|
272
|
+
# WHY theta AS PHASE, NOT A FREE phi: the previous revision's free-fit phi
|
|
273
|
+
# was severely confounded with A and tau (A varied >3x across a clean
|
|
274
|
+
# r-sweep despite R^2>0.95 in every individual fit -- a classic sign of an
|
|
275
|
+
# unidentifiable parameterization, not real physics). Reusing theta
|
|
276
|
+
# directly (matching the base ansatz's own convention) recovers most of
|
|
277
|
+
# what free-fit phi was doing -- R^2=0.85 vs 0.96 with 2 fewer free
|
|
278
|
+
# parameters -- and collapses A from a >200%-relative-spread quantity to
|
|
279
|
+
# ~5% across the same two independent sweeps (varying h at fixed |J|, and
|
|
280
|
+
# varying |J| at fixed h/(zJ)). A is treated as a constant here for that
|
|
281
|
+
# reason: its own residual variation, once the phase is properly assigned
|
|
282
|
+
# to theta, is small enough to not be worth another free parameter.
|
|
283
|
+
#
|
|
284
|
+
# HONEST VALIDATION STATUS: end-to-end (through the full generator, scored
|
|
285
|
+
# against the ideal Heisenberg+field circuit) this form was measured to
|
|
286
|
+
# underperform the previous revision's (A_of_r(r), free phi=-1.5, free
|
|
287
|
+
# tau=1/3) formula at every h tested in this file's small validation sweep
|
|
288
|
+
# (h=0.5, 2.0, 4.0; roughly 25-30% relative XEB R^2 loss). That gap is
|
|
289
|
+
# disclosed, not hidden -- the case for shipping this anyway is that a
|
|
290
|
+
# small local validation sweep is itself prone to rewarding whichever
|
|
291
|
+
# formula best matches its own quirks, and a formula built from already-
|
|
292
|
+
# validated structure (rather than fit to this sweep) is judged more
|
|
293
|
+
# likely to generalize correctly outside it. This is a judgment call, not
|
|
294
|
+
# a resolved empirical result -- flagged plainly for anyone re-deriving
|
|
295
|
+
# this in the future.
|
|
296
|
+
#
|
|
297
|
+
# omega(h, J) = 2h/|J| -- unchanged from the previous revision, confirmed
|
|
298
|
+
# via two independent sweeps (varying h at fixed |J|, and varying |J| at
|
|
299
|
+
# fixed h/|J|), both converging on the same relationship independently.
|
|
300
|
+
|
|
301
|
+
# A = -29.0 / 4.0
|
|
302
|
+
# (Dan says, let's try "-7.0" or "-8.0," friend.)
|
|
303
|
+
A = -7.0
|
|
256
304
|
|
|
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
305
|
|
|
262
306
|
@njit(cache=True)
|
|
263
|
-
def
|
|
264
|
-
|
|
265
|
-
return A_peak * 4 * abs(r) / (1 + abs(r))**2
|
|
307
|
+
def omega_of_h_J(h, J):
|
|
308
|
+
return (2 ** 24) if np.isclose(J, 0) else (2.0 * h / abs(J))
|
|
266
309
|
|
|
267
310
|
|
|
268
311
|
@njit(cache=True)
|
|
269
|
-
def beta_formula(t, J, h, z):
|
|
270
|
-
|
|
312
|
+
def beta_formula(t, J, h, z, theta):
|
|
313
|
+
omega_b = omega_of_h_J(h, J)
|
|
314
|
+
return A * np.cos(omega_b * J * t + theta) / (1.0 + np.sqrt(t))
|
|
271
315
|
|
|
272
316
|
|
|
273
317
|
@njit(cache=True)
|
|
@@ -295,5 +339,14 @@ def sample_from_bias(bias, shots, n_qubits):
|
|
|
295
339
|
|
|
296
340
|
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):
|
|
297
341
|
z_bias = get_tfim_hamming_distribution(J=J, h=h, z=z, theta=theta, t=t, n_qubits=n_qubits)
|
|
298
|
-
|
|
342
|
+
if abs(t) <= epsilon:
|
|
343
|
+
# At t=0 the base TFIM ansatz is already exact (a simple product
|
|
344
|
+
# state under the initial rotation, no time evolution yet). The
|
|
345
|
+
# beta(t) correction is a decaying oscillation fit to t >= dt data
|
|
346
|
+
# only, and is NOT constrained to (and does not, as fit) vanish at
|
|
347
|
+
# t=0 -- applying it there would corrupt an already-exact result.
|
|
348
|
+
# See the discussion above beta_formula for why this isn't a minor
|
|
349
|
+
# rounding matter: beta(0) evaluates to order -A, not order 0.
|
|
350
|
+
return sample_from_bias(z_bias, shots, n_qubits)
|
|
351
|
+
return sample_from_bias(tilt(z_bias, beta_formula(t, J, h, z, theta), n_qubits), shots, n_qubits)
|
|
299
352
|
|
|
@@ -7,7 +7,7 @@ with open(README_PATH) as readme_file:
|
|
|
7
7
|
|
|
8
8
|
setup(
|
|
9
9
|
name="pyqrackising",
|
|
10
|
-
version="9.16.
|
|
10
|
+
version="9.16.5",
|
|
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
|
|
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
|