PyQrackIsing 9.3.10__tar.gz → 9.3.11__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 (28) hide show
  1. {pyqrackising-9.3.10/pyqrackising.egg-info → pyqrackising-9.3.11}/PKG-INFO +1 -1
  2. {pyqrackising-9.3.10 → pyqrackising-9.3.11}/pyproject.toml +1 -1
  3. {pyqrackising-9.3.10 → pyqrackising-9.3.11}/pyqrackising/otoc.py +6 -57
  4. {pyqrackising-9.3.10 → pyqrackising-9.3.11/pyqrackising.egg-info}/PKG-INFO +1 -1
  5. {pyqrackising-9.3.10 → pyqrackising-9.3.11}/setup.py +1 -1
  6. {pyqrackising-9.3.10 → pyqrackising-9.3.11}/LICENSE.md +0 -0
  7. {pyqrackising-9.3.10 → pyqrackising-9.3.11}/MANIFEST.in +0 -0
  8. {pyqrackising-9.3.10 → pyqrackising-9.3.11}/README.md +0 -0
  9. {pyqrackising-9.3.10 → pyqrackising-9.3.11}/pyqrackising/__init__.py +0 -0
  10. {pyqrackising-9.3.10 → pyqrackising-9.3.11}/pyqrackising/convert_tensor_network_to_tsp.py +0 -0
  11. {pyqrackising-9.3.10 → pyqrackising-9.3.11}/pyqrackising/generate_tfim_samples.py +0 -0
  12. {pyqrackising-9.3.10 → pyqrackising-9.3.11}/pyqrackising/kernels.cl +0 -0
  13. {pyqrackising-9.3.10 → pyqrackising-9.3.11}/pyqrackising/maxcut_tfim.py +0 -0
  14. {pyqrackising-9.3.10 → pyqrackising-9.3.11}/pyqrackising/maxcut_tfim_sparse.py +0 -0
  15. {pyqrackising-9.3.10 → pyqrackising-9.3.11}/pyqrackising/maxcut_tfim_streaming.py +0 -0
  16. {pyqrackising-9.3.10 → pyqrackising-9.3.11}/pyqrackising/maxcut_tfim_util.py +0 -0
  17. {pyqrackising-9.3.10 → pyqrackising-9.3.11}/pyqrackising/spin_glass_solver.py +0 -0
  18. {pyqrackising-9.3.10 → pyqrackising-9.3.11}/pyqrackising/spin_glass_solver_sparse.py +0 -0
  19. {pyqrackising-9.3.10 → pyqrackising-9.3.11}/pyqrackising/spin_glass_solver_streaming.py +0 -0
  20. {pyqrackising-9.3.10 → pyqrackising-9.3.11}/pyqrackising/tfim_magnetization.py +0 -0
  21. {pyqrackising-9.3.10 → pyqrackising-9.3.11}/pyqrackising/tfim_square_magnetization.py +0 -0
  22. {pyqrackising-9.3.10 → pyqrackising-9.3.11}/pyqrackising/tsp.py +0 -0
  23. {pyqrackising-9.3.10 → pyqrackising-9.3.11}/pyqrackising/tsp_maxcut.py +0 -0
  24. {pyqrackising-9.3.10 → pyqrackising-9.3.11}/pyqrackising.egg-info/SOURCES.txt +0 -0
  25. {pyqrackising-9.3.10 → pyqrackising-9.3.11}/pyqrackising.egg-info/dependency_links.txt +0 -0
  26. {pyqrackising-9.3.10 → pyqrackising-9.3.11}/pyqrackising.egg-info/not-zip-safe +0 -0
  27. {pyqrackising-9.3.10 → pyqrackising-9.3.11}/pyqrackising.egg-info/top_level.txt +0 -0
  28. {pyqrackising-9.3.10 → pyqrackising-9.3.11}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyqrackising
3
- Version: 9.3.10
3
+ Version: 9.3.11
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.3.10"
13
+ version = "9.3.11"
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"}
@@ -73,21 +73,11 @@ def fix_cdf(hamming_prob):
73
73
  return cum_prob
74
74
 
75
75
 
76
- def take_all(b, basis, sample):
77
- for i in range(len(basis)):
78
- if basis[i] == b:
79
- sample |= (1 << i)
80
-
81
- return sample
82
-
83
-
84
- def take_sample(b, basis, sample, m, inv_dist):
85
- indices = []
76
+ def take_sample(n_qubits, sample, m, inv_dist):
77
+ indices = [i for i in range(n_qubits)]
86
78
  tot_inv_dist = 0.0
87
- for i in range(len(basis)):
88
- if basis[i] == b:
89
- indices.append(i)
90
- tot_inv_dist += inv_dist[i]
79
+ for i in range(n_qubits):
80
+ tot_inv_dist += inv_dist[i]
91
81
  selected = []
92
82
  for i in range(m):
93
83
  r = tot_inv_dist * np.random.random()
@@ -139,8 +129,7 @@ def get_inv_dist(butterfly_idx, n_qubits, row_len):
139
129
  q_row = q // row_len
140
130
  q_col = q % row_len
141
131
  dist = (q_row - b_row) ** 2 + (q_col - b_col) ** 2
142
- if dist > 0:
143
- inv_dist[q] += 1.0 / dist
132
+ inv_dist[q] += 1.0 / (1.0 + dist)
144
133
 
145
134
  return inv_dist
146
135
 
@@ -154,26 +143,6 @@ def generate_otoc_samples(J=-1.0, h=2.0, z=4, theta=0.174532925199432957, t=5, n
154
143
  if len(measurement_basis) != n_qubits:
155
144
  raise ValueError("OTOC measurement_basis must be same length as n_qubits! (Use 'I' for excluded qubits.)")
156
145
 
157
- basis_x, basis_y, basis_z = [], [], []
158
- for b in pauli_string:
159
- if b == 'Z':
160
- basis_z.append('X')
161
- basis_y.append('I')
162
- basis_x.append('Z')
163
- elif b == 'X':
164
- basis_z.append('Z')
165
- basis_y.append('I')
166
- basis_x.append('X')
167
- elif b == 'Y':
168
- basis_z.append('I')
169
- basis_y.append('Z')
170
- basis_x.append('I')
171
- else:
172
- basis_z.append('I')
173
- basis_y.append('I')
174
- basis_x.append('I')
175
-
176
- bases = { 'X': basis_x, 'Y': basis_y, 'Z': basis_z }
177
146
  thresholds = { key: fix_cdf(value) for key, value in get_otoc_hamming_distribution(J, h, z, theta, t, n_qubits, cycles, pauli_string).items() }
178
147
 
179
148
  row_len, col_len = factor_width(n_qubits)
@@ -192,8 +161,6 @@ def generate_otoc_samples(J=-1.0, h=2.0, z=4, theta=0.174532925199432957, t=5, n
192
161
  for _ in range(shots):
193
162
  sample_3_axis = { 'X': 0, 'Y': 0, 'Z': 0 }
194
163
  for key, value in thresholds.items():
195
- basis = bases[key]
196
-
197
164
  # First dimension: Hamming weight
198
165
  m = sample_mag(value)
199
166
  if m == 0:
@@ -203,25 +170,7 @@ def generate_otoc_samples(J=-1.0, h=2.0, z=4, theta=0.174532925199432957, t=5, n
203
170
  continue
204
171
 
205
172
  # Second dimension: permutation within Hamming weight
206
- z_count = basis.count('Z')
207
- if z_count > m:
208
- sample_3_axis[key] = take_sample('Z', basis, sample_3_axis[key], m, inv_dist[key])
209
- continue
210
- m -= z_count
211
- sample_3_axis[key] = take_all('Z', basis, sample_3_axis[key])
212
- if m == 0:
213
- continue
214
-
215
- i_count = basis.count('I')
216
- if i_count > m:
217
- sample_3_axis[key] = take_sample('I', basis, sample_3_axis[key], m, inv_dist[key])
218
- continue
219
- m -= i_count
220
- sample_3_axis[key] = take_all('I', basis, sample_3_axis[key])
221
- if m == 0:
222
- continue
223
-
224
- sample_3_axis[key] = take_sample('X', basis, sample_3_axis[key], m, inv_dist[key])
173
+ sample_3_axis[key] = take_sample(n_qubits, sample_3_axis[key], m, inv_dist[key])
225
174
 
226
175
  sample = 0
227
176
  j = 0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyqrackising
3
- Version: 9.3.10
3
+ Version: 9.3.11
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.3.10',
10
+ version='9.3.11',
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