pyqrackising 9.4.0__tar.gz → 9.5.0__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.

Potentially problematic release.


This version of pyqrackising might be problematic. Click here for more details.

Files changed (28) hide show
  1. {pyqrackising-9.4.0/pyqrackising.egg-info → pyqrackising-9.5.0}/PKG-INFO +1 -1
  2. {pyqrackising-9.4.0 → pyqrackising-9.5.0}/pyproject.toml +1 -1
  3. {pyqrackising-9.4.0 → pyqrackising-9.5.0}/pyqrackising/otoc.py +43 -47
  4. {pyqrackising-9.4.0 → pyqrackising-9.5.0/pyqrackising.egg-info}/PKG-INFO +1 -1
  5. {pyqrackising-9.4.0 → pyqrackising-9.5.0}/setup.py +1 -1
  6. {pyqrackising-9.4.0 → pyqrackising-9.5.0}/LICENSE.md +0 -0
  7. {pyqrackising-9.4.0 → pyqrackising-9.5.0}/MANIFEST.in +0 -0
  8. {pyqrackising-9.4.0 → pyqrackising-9.5.0}/README.md +0 -0
  9. {pyqrackising-9.4.0 → pyqrackising-9.5.0}/pyqrackising/__init__.py +0 -0
  10. {pyqrackising-9.4.0 → pyqrackising-9.5.0}/pyqrackising/convert_tensor_network_to_tsp.py +0 -0
  11. {pyqrackising-9.4.0 → pyqrackising-9.5.0}/pyqrackising/generate_tfim_samples.py +0 -0
  12. {pyqrackising-9.4.0 → pyqrackising-9.5.0}/pyqrackising/kernels.cl +0 -0
  13. {pyqrackising-9.4.0 → pyqrackising-9.5.0}/pyqrackising/maxcut_tfim.py +0 -0
  14. {pyqrackising-9.4.0 → pyqrackising-9.5.0}/pyqrackising/maxcut_tfim_sparse.py +0 -0
  15. {pyqrackising-9.4.0 → pyqrackising-9.5.0}/pyqrackising/maxcut_tfim_streaming.py +0 -0
  16. {pyqrackising-9.4.0 → pyqrackising-9.5.0}/pyqrackising/maxcut_tfim_util.py +0 -0
  17. {pyqrackising-9.4.0 → pyqrackising-9.5.0}/pyqrackising/spin_glass_solver.py +0 -0
  18. {pyqrackising-9.4.0 → pyqrackising-9.5.0}/pyqrackising/spin_glass_solver_sparse.py +0 -0
  19. {pyqrackising-9.4.0 → pyqrackising-9.5.0}/pyqrackising/spin_glass_solver_streaming.py +0 -0
  20. {pyqrackising-9.4.0 → pyqrackising-9.5.0}/pyqrackising/tfim_magnetization.py +0 -0
  21. {pyqrackising-9.4.0 → pyqrackising-9.5.0}/pyqrackising/tfim_square_magnetization.py +0 -0
  22. {pyqrackising-9.4.0 → pyqrackising-9.5.0}/pyqrackising/tsp.py +0 -0
  23. {pyqrackising-9.4.0 → pyqrackising-9.5.0}/pyqrackising/tsp_maxcut.py +0 -0
  24. {pyqrackising-9.4.0 → pyqrackising-9.5.0}/pyqrackising.egg-info/SOURCES.txt +0 -0
  25. {pyqrackising-9.4.0 → pyqrackising-9.5.0}/pyqrackising.egg-info/dependency_links.txt +0 -0
  26. {pyqrackising-9.4.0 → pyqrackising-9.5.0}/pyqrackising.egg-info/not-zip-safe +0 -0
  27. {pyqrackising-9.4.0 → pyqrackising-9.5.0}/pyqrackising.egg-info/top_level.txt +0 -0
  28. {pyqrackising-9.4.0 → pyqrackising-9.5.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyqrackising
3
- Version: 9.4.0
3
+ Version: 9.5.0
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
@@ -10,7 +10,7 @@ build-backend = "setuptools.build_meta"
10
10
 
11
11
  [project]
12
12
  name = "pyqrackising"
13
- version = "9.4.0"
13
+ version = "9.5.0"
14
14
  requires-python = ">=3.8"
15
15
  description = "Fast MAXCUT, TSP, and sampling heuristics from near-ideal transverse field Ising model (TFIM)"
16
16
  readme = {file = "README.txt", content-type = "text/markdown"}
@@ -7,45 +7,44 @@ import sys
7
7
  epsilon = opencl_context.epsilon
8
8
 
9
9
 
10
- def get_otoc_hamming_distribution(J=-1.0, h=2.0, z=4, theta=0.174532925199432957, t=5, n_qubits=56, cycles=1, pauli_string = 'X' + 'I' * 55):
11
- pauli_string = list(pauli_string)
12
- if len(pauli_string) != n_qubits:
13
- raise ValueError("OTOCS pauli_string must be same length as n_qubits! (Use 'I' for qubits that aren't changed.)")
14
-
10
+ def get_otoc_hamming_distribution(J=-1.0, h=2.0, z=4, theta=0.0, t=5, n_qubits=65, pauli_strings = ['X' + 'I' * 64]):
15
11
  n_bias = n_qubits + 1
16
12
  if h <= epsilon:
17
13
  bias = np.empty(n_bias, dtype=np.float64)
18
14
  bias[0] = 1.0
19
- return { 'X': bias, 'Y': bias, 'Z': bias }
20
-
21
- fwd = probability_by_hamming_weight(J, h, z, theta, t, n_qubits + 1)
22
- rev = probability_by_hamming_weight(-J, -h, z, theta + np.pi, t, n_qubits + 1)
23
- diff_theta = rev - fwd
24
-
25
- phi = theta + np.pi / 2
26
- fwd = probability_by_hamming_weight(-h, -J, z, phi, t, n_qubits + 1)
27
- rev = probability_by_hamming_weight(h, J, z, phi + np.pi, t, n_qubits + 1)
28
- diff_phi = rev - fwd
29
-
30
- # Lambda (Y-axis) is at a right angle to both J and h,
31
- # so there is no difference in this dimension.
32
-
33
- diff_theta *= cycles
34
- diff_phi *= cycles
15
+ return bias
35
16
 
36
17
  diff_z = np.zeros(n_bias, dtype=np.float64)
37
- for b in pauli_string:
38
- match b:
39
- case 'X':
40
- diff_z += diff_theta
41
- case 'Z':
42
- diff_z += diff_phi
43
- case 'Y':
44
- diff_z += diff_theta + diff_phi
45
- case _:
46
- pass
47
-
48
- diff_z[0] += n_qubits
18
+ for pauli_string in pauli_strings:
19
+ pauli_string = list(pauli_string)
20
+ if len(pauli_string) != n_qubits:
21
+ raise ValueError("OTOCS pauli_string must be same length as n_qubits! (Use 'I' for qubits that aren't changed.)")
22
+
23
+ fwd = probability_by_hamming_weight(J, h, z, theta, t, n_qubits + 1)
24
+ rev = probability_by_hamming_weight(-J, -h, z, theta + np.pi, t, n_qubits + 1)
25
+ diff_theta = rev - fwd
26
+
27
+ phi = theta + np.pi / 2
28
+ fwd = probability_by_hamming_weight(-h, -J, z, phi, t, n_qubits + 1)
29
+ rev = probability_by_hamming_weight(h, J, z, phi + np.pi, t, n_qubits + 1)
30
+ diff_phi = rev - fwd
31
+
32
+ # Lambda (Y-axis) is at a right angle to both J and h,
33
+ # so there is no difference in this dimension.
34
+
35
+ diff_z[0] += n_qubits
36
+ for b in pauli_string:
37
+ match b:
38
+ case 'X':
39
+ diff_z += diff_theta
40
+ case 'Z':
41
+ diff_z += diff_phi
42
+ case 'Y':
43
+ diff_z += diff_theta + diff_phi
44
+ case _:
45
+ pass
46
+
47
+ # Normalize:
49
48
  diff_z /= diff_z.sum()
50
49
 
51
50
  return diff_z
@@ -162,22 +161,19 @@ def get_inv_dist(butterfly_idx_x, butterfly_idx_z, n_qubits, row_len, col_len):
162
161
  return inv_dist
163
162
 
164
163
 
165
- def generate_otoc_samples(J=-1.0, h=2.0, z=4, theta=0.174532925199432957, t=5, n_qubits=56, cycles=1, pauli_string = 'X' + 'I' * 55, shots=100, is_orbifold=True):
166
- pauli_string = list(pauli_string)
167
- if len(pauli_string) != n_qubits:
168
- raise ValueError("OTOC pauli_string must be same length as n_qubits! (Use 'I' for qubits that aren't changed.)")
169
-
170
- thresholds = fix_cdf(get_otoc_hamming_distribution(J, h, z, theta, t, n_qubits, cycles, pauli_string))
164
+ def generate_otoc_samples(J=-1.0, h=2.0, z=4, theta=0.0, t=5, n_qubits=65, pauli_strings = ['X' + 'I' * 64], shots=100, is_orbifold=True):
165
+ thresholds = fix_cdf(get_otoc_hamming_distribution(J, h, z, theta, t, n_qubits, pauli_strings))
171
166
 
172
167
  row_len, col_len = factor_width(n_qubits)
173
- p_string = "".join(pauli_string)
174
- butterfly_idx_x = find_all_str_occurrences(p_string, 'X')
175
- butterfly_idx_z = find_all_str_occurrences(p_string, 'Z')
176
-
177
- if is_orbifold:
178
- inv_dist = get_inv_dist(butterfly_idx_x, butterfly_idx_z, n_qubits, row_len, col_len)
179
- else:
180
- inv_dist = get_willow_inv_dist(butterfly_idx_x, butterfly_idx_z, n_qubits, row_len, col_len)
168
+ inv_dist = np.zeros(n_qubits, dtype=np.float64)
169
+ for pauli_string in pauli_strings:
170
+ butterfly_idx_x = find_all_str_occurrences(pauli_string, 'X')
171
+ butterfly_idx_z = find_all_str_occurrences(pauli_string, 'Z')
172
+ if is_orbifold:
173
+ inv_dist += get_inv_dist(butterfly_idx_x, butterfly_idx_z, n_qubits, row_len, col_len)
174
+ else:
175
+ inv_dist += get_willow_inv_dist(butterfly_idx_x, butterfly_idx_z, n_qubits, row_len, col_len)
176
+ inv_dist /= 2.0
181
177
 
182
178
  samples = []
183
179
  for _ in range(shots):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyqrackising
3
- Version: 9.4.0
3
+ Version: 9.5.0
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.4.0',
10
+ version='9.5.0',
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