pyqrackising 9.3.10__py3-none-macosx_14_0_arm64.whl → 9.3.11__py3-none-macosx_14_0_arm64.whl
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.
- pyqrackising/otoc.py +6 -57
- {pyqrackising-9.3.10.dist-info → pyqrackising-9.3.11.dist-info}/METADATA +1 -1
- {pyqrackising-9.3.10.dist-info → pyqrackising-9.3.11.dist-info}/RECORD +6 -6
- {pyqrackising-9.3.10.dist-info → pyqrackising-9.3.11.dist-info}/WHEEL +0 -0
- {pyqrackising-9.3.10.dist-info → pyqrackising-9.3.11.dist-info}/licenses/LICENSE.md +0 -0
- {pyqrackising-9.3.10.dist-info → pyqrackising-9.3.11.dist-info}/top_level.txt +0 -0
pyqrackising/otoc.py
CHANGED
|
@@ -73,21 +73,11 @@ def fix_cdf(hamming_prob):
|
|
|
73
73
|
return cum_prob
|
|
74
74
|
|
|
75
75
|
|
|
76
|
-
def
|
|
77
|
-
for i in range(
|
|
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(
|
|
88
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
@@ -6,7 +6,7 @@ pyqrackising/maxcut_tfim.py,sha256=U1nNjyfMS48TtTQk7TRf5_VF3pVPfAcZEa2awc2nR8k,1
|
|
|
6
6
|
pyqrackising/maxcut_tfim_sparse.py,sha256=eenJNSEwRvgwACfKoH0tj6rpn7uqH6nNTBuxUPh_lDg,11941
|
|
7
7
|
pyqrackising/maxcut_tfim_streaming.py,sha256=FkBsRoXSRhv4gUeN9O7Ivx54oxq_SqiCDKnYsyxU4bs,6664
|
|
8
8
|
pyqrackising/maxcut_tfim_util.py,sha256=nMLrbvDMsCtVgbS4vbRNSZYpdne5YzdifjlQbbWmKjU,16935
|
|
9
|
-
pyqrackising/otoc.py,sha256
|
|
9
|
+
pyqrackising/otoc.py,sha256=CciS348HDws8spCgkWxeKaaHNIqGMsml52T337e-db8,6119
|
|
10
10
|
pyqrackising/spin_glass_solver.py,sha256=YtsIfYfpwhEMQPVd_sbjqpz6nQcrv8p2mUBYZ-wRpnM,13792
|
|
11
11
|
pyqrackising/spin_glass_solver_sparse.py,sha256=E4Ft7H-uKXZyq1cS7Z77AgdkL5fMlKMK6DwnXgrgOhk,14740
|
|
12
12
|
pyqrackising/spin_glass_solver_streaming.py,sha256=xpWq63yODMzBPQQtpDuB1Tro6ta8pPbVwc0ZkDWVASk,10018
|
|
@@ -14,8 +14,8 @@ pyqrackising/tfim_magnetization.py,sha256=On1MhCNGGHRxJFRmCOpMcdqQJiy25gWkjz0Ka8
|
|
|
14
14
|
pyqrackising/tfim_square_magnetization.py,sha256=9uJCT8ytyufcGFrZiignjCkWJr9UcP44sAAy0BIBw34,531
|
|
15
15
|
pyqrackising/tsp.py,sha256=kqDxU2RCjad-T4tW_C9WO1I-COSwX7fHB6VhIuQsjfQ,62464
|
|
16
16
|
pyqrackising/tsp_maxcut.py,sha256=ngxfSJgePXVwJXfNXYdk4jv1ISznx8zHOqR-Vbf33B0,9772
|
|
17
|
-
pyqrackising-9.3.
|
|
18
|
-
pyqrackising-9.3.
|
|
19
|
-
pyqrackising-9.3.
|
|
20
|
-
pyqrackising-9.3.
|
|
21
|
-
pyqrackising-9.3.
|
|
17
|
+
pyqrackising-9.3.11.dist-info/licenses/LICENSE.md,sha256=46mU2C5kSwOnkqkw9XQAJlhBL2JAf1_uCD8lVcXyMRg,7652
|
|
18
|
+
pyqrackising-9.3.11.dist-info/METADATA,sha256=kXHONRvf5Sxh3LqfylPxpJIf_GsTKw0pd6Xjpgop5ng,1144
|
|
19
|
+
pyqrackising-9.3.11.dist-info/WHEEL,sha256=97pmOSfusofyzGlW1jJA8mX_ciF6NJq3BQs-Zshjrk4,105
|
|
20
|
+
pyqrackising-9.3.11.dist-info/top_level.txt,sha256=bxlfGuLwzeVEI8Jm5D9HvC_WedgvvkSrpFwbGDjg-Ag,13
|
|
21
|
+
pyqrackising-9.3.11.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|