PyQrackIsing 6.2.2__tar.gz → 6.2.4__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-6.2.2/pyqrackising.egg-info → pyqrackising-6.2.4}/PKG-INFO +1 -1
- {pyqrackising-6.2.2 → pyqrackising-6.2.4}/pyproject.toml +1 -1
- {pyqrackising-6.2.2 → pyqrackising-6.2.4}/pyqrackising/convert_tensor_network_to_tsp.py +1 -1
- {pyqrackising-6.2.2 → pyqrackising-6.2.4}/pyqrackising/kernels.cl +17 -19
- {pyqrackising-6.2.2 → pyqrackising-6.2.4}/pyqrackising/maxcut_tfim_util.py +3 -0
- {pyqrackising-6.2.2 → pyqrackising-6.2.4/pyqrackising.egg-info}/PKG-INFO +1 -1
- {pyqrackising-6.2.2 → pyqrackising-6.2.4}/setup.py +1 -1
- {pyqrackising-6.2.2 → pyqrackising-6.2.4}/CMakeLists.txt +0 -0
- {pyqrackising-6.2.2 → pyqrackising-6.2.4}/LICENSE.md +0 -0
- {pyqrackising-6.2.2 → pyqrackising-6.2.4}/MANIFEST.in +0 -0
- {pyqrackising-6.2.2 → pyqrackising-6.2.4}/README.md +0 -0
- {pyqrackising-6.2.2 → pyqrackising-6.2.4}/pyqrackising/__init__.py +0 -0
- {pyqrackising-6.2.2 → pyqrackising-6.2.4}/pyqrackising/_pyqrack_ising.cpp +0 -0
- {pyqrackising-6.2.2 → pyqrackising-6.2.4}/pyqrackising/generate_tfim_samples.py +0 -0
- {pyqrackising-6.2.2 → pyqrackising-6.2.4}/pyqrackising/maxcut_tfim.py +0 -0
- {pyqrackising-6.2.2 → pyqrackising-6.2.4}/pyqrackising/maxcut_tfim_sparse.py +0 -0
- {pyqrackising-6.2.2 → pyqrackising-6.2.4}/pyqrackising/maxcut_tfim_streaming.py +0 -0
- {pyqrackising-6.2.2 → pyqrackising-6.2.4}/pyqrackising/spin_glass_solver.py +0 -0
- {pyqrackising-6.2.2 → pyqrackising-6.2.4}/pyqrackising/spin_glass_solver_sparse.py +0 -0
- {pyqrackising-6.2.2 → pyqrackising-6.2.4}/pyqrackising/spin_glass_solver_streaming.py +0 -0
- {pyqrackising-6.2.2 → pyqrackising-6.2.4}/pyqrackising/spin_glass_solver_util.py +0 -0
- {pyqrackising-6.2.2 → pyqrackising-6.2.4}/pyqrackising/tfim_magnetization.py +0 -0
- {pyqrackising-6.2.2 → pyqrackising-6.2.4}/pyqrackising/tfim_square_magnetization.py +0 -0
- {pyqrackising-6.2.2 → pyqrackising-6.2.4}/pyqrackising/tsp.py +0 -0
- {pyqrackising-6.2.2 → pyqrackising-6.2.4}/pyqrackising.egg-info/SOURCES.txt +0 -0
- {pyqrackising-6.2.2 → pyqrackising-6.2.4}/pyqrackising.egg-info/dependency_links.txt +0 -0
- {pyqrackising-6.2.2 → pyqrackising-6.2.4}/pyqrackising.egg-info/not-zip-safe +0 -0
- {pyqrackising-6.2.2 → pyqrackising-6.2.4}/pyqrackising.egg-info/top_level.txt +0 -0
- {pyqrackising-6.2.2 → pyqrackising-6.2.4}/setup.cfg +0 -0
|
@@ -12,7 +12,7 @@ build-backend = "setuptools.build_meta"
|
|
|
12
12
|
|
|
13
13
|
[project]
|
|
14
14
|
name = "pyqrackising"
|
|
15
|
-
version = "6.2.
|
|
15
|
+
version = "6.2.4"
|
|
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"}
|
|
@@ -85,7 +85,7 @@ def convert_quimb_tree_to_tsp(tn, dtype=np.float32):
|
|
|
85
85
|
|
|
86
86
|
for tensor in tn.tensors:
|
|
87
87
|
# Use a unique tag or fallback to name
|
|
88
|
-
tensor_id =
|
|
88
|
+
tensor_id = frozenset(tensor.tags) if tensor.tags else str(tensor.name)
|
|
89
89
|
tensors.append({
|
|
90
90
|
"id": tensor_id,
|
|
91
91
|
"indices": set(tensor.inds)
|
|
@@ -4,9 +4,7 @@
|
|
|
4
4
|
#else
|
|
5
5
|
#define fwrapper(f, a) f(a)
|
|
6
6
|
#define fwrapper2(f, a, b) f(a, b)
|
|
7
|
-
#define INFINITY_R1 INFINITY
|
|
8
7
|
#endif
|
|
9
|
-
#define INFINITY_R1 ((real1)INFINITY)
|
|
10
8
|
|
|
11
9
|
__kernel void init_theta(
|
|
12
10
|
__constant real1* fargs,
|
|
@@ -34,7 +32,7 @@ __kernel void init_theta(
|
|
|
34
32
|
|
|
35
33
|
// By Google Search AI
|
|
36
34
|
#if FP16
|
|
37
|
-
|
|
35
|
+
void atomic_add_real1(__global real1* address, real1 val, bool highWord) {
|
|
38
36
|
union {
|
|
39
37
|
uint intVal;
|
|
40
38
|
real1 floatVal[2];
|
|
@@ -53,7 +51,7 @@ inline void atomic_add_real1(__global real1* address, real1 val, bool highWord)
|
|
|
53
51
|
} while (atomic_cmpxchg((__global uint*)address, oldVal.intVal, newVal.intVal) != oldVal.intVal);
|
|
54
52
|
}
|
|
55
53
|
#else
|
|
56
|
-
|
|
54
|
+
void atomic_add_real1(__global real1* address, real1 val) {
|
|
57
55
|
union {
|
|
58
56
|
qint intVal;
|
|
59
57
|
real1 floatVal;
|
|
@@ -68,7 +66,7 @@ inline void atomic_add_real1(__global real1* address, real1 val) {
|
|
|
68
66
|
#endif
|
|
69
67
|
|
|
70
68
|
// By Elara (custom OpenAI GPT)
|
|
71
|
-
|
|
69
|
+
real1 probability_by_hamming_weight(
|
|
72
70
|
int q, real1 J, real1 h, uint z, real1 theta, real1 t, int n_qubits
|
|
73
71
|
) {
|
|
74
72
|
real1 ratio = fwrapper(fabs, h) / (z * J);
|
|
@@ -186,7 +184,7 @@ __kernel void bootstrap(
|
|
|
186
184
|
// The inputs are chaotic, and this doesn't need to be high-quality, just uniform.
|
|
187
185
|
prng_seed ^= (uint)i;
|
|
188
186
|
|
|
189
|
-
real1 energy =
|
|
187
|
+
real1 energy = INFINITY;
|
|
190
188
|
|
|
191
189
|
if (i < combo_count) {
|
|
192
190
|
const int j = i * k;
|
|
@@ -271,7 +269,7 @@ __kernel void bootstrap_sparse(
|
|
|
271
269
|
|
|
272
270
|
prng_seed ^= (uint)i;
|
|
273
271
|
|
|
274
|
-
real1 energy =
|
|
272
|
+
real1 energy = INFINITY;
|
|
275
273
|
|
|
276
274
|
if (i < combo_count) {
|
|
277
275
|
const int j = i * k;
|
|
@@ -366,7 +364,7 @@ __kernel void sample_for_solution_best_bitset(
|
|
|
366
364
|
for (int w = 0; w < words; w++) sol_bits[w] = 0;
|
|
367
365
|
uint temp_sol[MAX_WORDS];
|
|
368
366
|
|
|
369
|
-
real1 cut_val = -
|
|
367
|
+
real1 cut_val = -INFINITY;
|
|
370
368
|
for (int gid = gid_orig; gid < shots; gid += MAX_PROC_ELEM) {
|
|
371
369
|
|
|
372
370
|
// --- 1. Choose Hamming weight
|
|
@@ -383,7 +381,7 @@ __kernel void sample_for_solution_best_bitset(
|
|
|
383
381
|
real1 highest_weights[TOP_N];
|
|
384
382
|
int best_bits[TOP_N];
|
|
385
383
|
for (int x = 0; x < TOP_N; ++x) {
|
|
386
|
-
highest_weights[x] = -
|
|
384
|
+
highest_weights[x] = -INFINITY;
|
|
387
385
|
best_bits[x] = -1;
|
|
388
386
|
}
|
|
389
387
|
|
|
@@ -413,13 +411,13 @@ __kernel void sample_for_solution_best_bitset(
|
|
|
413
411
|
|
|
414
412
|
int lowest_option = 0;
|
|
415
413
|
real1 lowest_weight = highest_weights[0];
|
|
416
|
-
if (-lowest_weight !=
|
|
414
|
+
if (-lowest_weight != INFINITY) {
|
|
417
415
|
for (int x = 1; x < TOP_N; ++x) {
|
|
418
416
|
real1 val = highest_weights[x];
|
|
419
417
|
if (val < lowest_weight) {
|
|
420
418
|
lowest_option = x;
|
|
421
419
|
lowest_weight = highest_weights[x];
|
|
422
|
-
if (-val ==
|
|
420
|
+
if (-val == INFINITY) {
|
|
423
421
|
break;
|
|
424
422
|
}
|
|
425
423
|
}
|
|
@@ -436,7 +434,7 @@ __kernel void sample_for_solution_best_bitset(
|
|
|
436
434
|
real1 total_weight = ZERO_R1;
|
|
437
435
|
for (int x = 0; x < TOP_N; ++x) {
|
|
438
436
|
const real1 val = highest_weights[x];
|
|
439
|
-
if (-val ==
|
|
437
|
+
if (-val == INFINITY) {
|
|
440
438
|
continue;
|
|
441
439
|
}
|
|
442
440
|
total_weight += val;
|
|
@@ -447,7 +445,7 @@ __kernel void sample_for_solution_best_bitset(
|
|
|
447
445
|
int best_bit = 0;
|
|
448
446
|
for (int x = 0; x < TOP_N; ++x) {
|
|
449
447
|
const real1 val = highest_weights[x];
|
|
450
|
-
if (-val ==
|
|
448
|
+
if (-val == INFINITY) {
|
|
451
449
|
continue;
|
|
452
450
|
}
|
|
453
451
|
tot_prob += val;
|
|
@@ -573,7 +571,7 @@ __kernel void sample_for_solution_best_bitset_sparse(
|
|
|
573
571
|
for (int w = 0; w < words; w++) sol_bits[w] = 0;
|
|
574
572
|
uint temp_sol[MAX_WORDS];
|
|
575
573
|
|
|
576
|
-
real1 cut_val = -
|
|
574
|
+
real1 cut_val = -INFINITY;
|
|
577
575
|
for (int gid = gid_orig; gid < shots; gid += MAX_PROC_ELEM) {
|
|
578
576
|
|
|
579
577
|
// --- 1. Choose Hamming weight
|
|
@@ -590,7 +588,7 @@ __kernel void sample_for_solution_best_bitset_sparse(
|
|
|
590
588
|
real1 highest_weights[TOP_N];
|
|
591
589
|
int best_bits[TOP_N];
|
|
592
590
|
for (int x = 0; x < TOP_N; ++x) {
|
|
593
|
-
highest_weights[x] = -
|
|
591
|
+
highest_weights[x] = -INFINITY;
|
|
594
592
|
best_bits[x] = -1;
|
|
595
593
|
}
|
|
596
594
|
|
|
@@ -629,13 +627,13 @@ __kernel void sample_for_solution_best_bitset_sparse(
|
|
|
629
627
|
|
|
630
628
|
int lowest_option = 0;
|
|
631
629
|
real1 lowest_weight = highest_weights[0];
|
|
632
|
-
if (-lowest_weight !=
|
|
630
|
+
if (-lowest_weight != INFINITY) {
|
|
633
631
|
for (int x = 0; x < TOP_N; ++x) {
|
|
634
632
|
real1 val = highest_weights[x];
|
|
635
633
|
if (val < lowest_weight) {
|
|
636
634
|
lowest_option = x;
|
|
637
635
|
lowest_weight = highest_weights[x];
|
|
638
|
-
if (-val ==
|
|
636
|
+
if (-val == INFINITY) {
|
|
639
637
|
break;
|
|
640
638
|
}
|
|
641
639
|
}
|
|
@@ -652,7 +650,7 @@ __kernel void sample_for_solution_best_bitset_sparse(
|
|
|
652
650
|
real1 total_weight = ZERO_R1;
|
|
653
651
|
for (int x = 0; x < TOP_N; ++x) {
|
|
654
652
|
const real1 val = highest_weights[x];
|
|
655
|
-
if (-val ==
|
|
653
|
+
if (-val == INFINITY) {
|
|
656
654
|
continue;
|
|
657
655
|
}
|
|
658
656
|
total_weight += val;
|
|
@@ -663,7 +661,7 @@ __kernel void sample_for_solution_best_bitset_sparse(
|
|
|
663
661
|
int best_bit = 0;
|
|
664
662
|
for (int x = 0; x < TOP_N; ++x) {
|
|
665
663
|
const real1 val = highest_weights[x];
|
|
666
|
-
if (-val ==
|
|
664
|
+
if (-val == INFINITY) {
|
|
667
665
|
continue;
|
|
668
666
|
}
|
|
669
667
|
tot_prob += val;
|
|
@@ -51,7 +51,7 @@ ext_modules = [CMakeExtension('tfim_sampler')]
|
|
|
51
51
|
|
|
52
52
|
setup(
|
|
53
53
|
name='pyqrackising',
|
|
54
|
-
version='6.2.
|
|
54
|
+
version='6.2.4',
|
|
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
|
|
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
|