pyqrack-cuda 1.44.13__tar.gz → 1.44.15__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 (29) hide show
  1. {pyqrack_cuda-1.44.13/pyqrack_cuda.egg-info → pyqrack_cuda-1.44.15}/PKG-INFO +1 -1
  2. {pyqrack_cuda-1.44.13 → pyqrack_cuda-1.44.15}/pyqrack/qrack_ace_backend.py +39 -20
  3. {pyqrack_cuda-1.44.13 → pyqrack_cuda-1.44.15/pyqrack_cuda.egg-info}/PKG-INFO +1 -1
  4. {pyqrack_cuda-1.44.13 → pyqrack_cuda-1.44.15}/setup.py +1 -1
  5. {pyqrack_cuda-1.44.13 → pyqrack_cuda-1.44.15}/LICENSE +0 -0
  6. {pyqrack_cuda-1.44.13 → pyqrack_cuda-1.44.15}/MANIFEST.in +0 -0
  7. {pyqrack_cuda-1.44.13 → pyqrack_cuda-1.44.15}/Makefile +0 -0
  8. {pyqrack_cuda-1.44.13 → pyqrack_cuda-1.44.15}/README.md +0 -0
  9. {pyqrack_cuda-1.44.13 → pyqrack_cuda-1.44.15}/pyproject.toml +0 -0
  10. {pyqrack_cuda-1.44.13 → pyqrack_cuda-1.44.15}/pyqrack/__init__.py +0 -0
  11. {pyqrack_cuda-1.44.13 → pyqrack_cuda-1.44.15}/pyqrack/neuron_activation_fn.py +0 -0
  12. {pyqrack_cuda-1.44.13 → pyqrack_cuda-1.44.15}/pyqrack/pauli.py +0 -0
  13. {pyqrack_cuda-1.44.13 → pyqrack_cuda-1.44.15}/pyqrack/qrack_circuit.py +0 -0
  14. {pyqrack_cuda-1.44.13 → pyqrack_cuda-1.44.15}/pyqrack/qrack_neuron.py +0 -0
  15. {pyqrack_cuda-1.44.13 → pyqrack_cuda-1.44.15}/pyqrack/qrack_neuron_torch_layer.py +0 -0
  16. {pyqrack_cuda-1.44.13 → pyqrack_cuda-1.44.15}/pyqrack/qrack_simulator.py +0 -0
  17. {pyqrack_cuda-1.44.13 → pyqrack_cuda-1.44.15}/pyqrack/qrack_stabilizer.py +0 -0
  18. {pyqrack_cuda-1.44.13 → pyqrack_cuda-1.44.15}/pyqrack/qrack_system/__init__.py +0 -0
  19. {pyqrack_cuda-1.44.13 → pyqrack_cuda-1.44.15}/pyqrack/qrack_system/qrack_system.py +0 -0
  20. {pyqrack_cuda-1.44.13 → pyqrack_cuda-1.44.15}/pyqrack/quimb_circuit_type.py +0 -0
  21. {pyqrack_cuda-1.44.13 → pyqrack_cuda-1.44.15}/pyqrack/stats/__init__.py +0 -0
  22. {pyqrack_cuda-1.44.13 → pyqrack_cuda-1.44.15}/pyqrack/stats/load_quantized_data.py +0 -0
  23. {pyqrack_cuda-1.44.13 → pyqrack_cuda-1.44.15}/pyqrack/stats/quantize_by_range.py +0 -0
  24. {pyqrack_cuda-1.44.13 → pyqrack_cuda-1.44.15}/pyqrack_cuda.egg-info/SOURCES.txt +0 -0
  25. {pyqrack_cuda-1.44.13 → pyqrack_cuda-1.44.15}/pyqrack_cuda.egg-info/dependency_links.txt +0 -0
  26. {pyqrack_cuda-1.44.13 → pyqrack_cuda-1.44.15}/pyqrack_cuda.egg-info/not-zip-safe +0 -0
  27. {pyqrack_cuda-1.44.13 → pyqrack_cuda-1.44.15}/pyqrack_cuda.egg-info/requires.txt +0 -0
  28. {pyqrack_cuda-1.44.13 → pyqrack_cuda-1.44.15}/pyqrack_cuda.egg-info/top_level.txt +0 -0
  29. {pyqrack_cuda-1.44.13 → pyqrack_cuda-1.44.15}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyqrack-cuda
3
- Version: 1.44.13
3
+ Version: 1.44.15
4
4
  Summary: pyqrack - Pure Python vm6502q/qrack Wrapper
5
5
  Home-page: https://github.com/vm6502q/pyqrack
6
6
  Author: Daniel Strano
@@ -120,6 +120,9 @@ class QrackAceBackend:
120
120
  self.sim.mcx([hq[0]], hq[1])
121
121
 
122
122
  def _correct(self, lq):
123
+ # We can't use true syndrome-based error correction,
124
+ # because one of the qubits in the code is separated.
125
+ # However, we can get pretty close!
123
126
  hq = self._unpack(lq)
124
127
  shots = 1024
125
128
  samples = self.sim.measure_shots(hq, shots)
@@ -138,92 +141,111 @@ class QrackAceBackend:
138
141
  syndrome[1] += 1
139
142
  case 3:
140
143
  syndrome[2] += 1
144
+
145
+ row = (hq[0] // 3) // self.row_length
146
+ even_row = not (row & 1)
147
+ single_bit = 0
148
+ other_bits = []
149
+ if (not self.alternating_codes or even_row):
150
+ single_bit = 2
151
+ other_bits = [0, 1]
152
+ else:
153
+ single_bit = 0
154
+ other_bits = [1, 2]
155
+
141
156
  max_syndrome = max(syndrome)
142
- if (2 * max_syndrome) > shots:
143
- error_bit = syndrome.index(max_syndrome)
144
- row = (hq[0] // 3) // self.row_length
145
- even_row = not (row & 1)
146
- single_bit = 2 if (not self.alternating_codes or even_row) else 0
157
+ error_bit = syndrome.index(max_syndrome)
158
+ force_syndrome = True
159
+ if (2 * max_syndrome) >= shots:
160
+ # There is an error.
147
161
  if error_bit == single_bit:
162
+ # The stand-alone bit carries the error.
148
163
  self.sim.x(hq[error_bit])
149
164
  else:
150
- self.sim.mcx([hq[1]], self._ancilla)
151
- self.sim.mcx([hq[2]], self._ancilla)
165
+ # The coherent bits carry the error.
166
+ force_syndrome = False
167
+ # Form their syndrome.
168
+ self.sim.mcx([hq[other_bits[0]]], self._ancilla)
169
+ self.sim.mcx([hq[other_bits[1]]], self._ancilla)
170
+ # Force the syndrome pathological
152
171
  self.sim.force_m(self._ancilla, True)
172
+ # Reset the ancilla.
173
+ self.sim.x(self._ancilla)
174
+ # Correct the bit flip.
153
175
  self.sim.x(hq[error_bit])
154
176
 
177
+ # There is no error.
178
+ if force_syndrome:
179
+ # Form the syndrome of the coherent bits.
180
+ self.sim.mcx([hq[other_bits[0]]], self._ancilla)
181
+ self.sim.mcx([hq[other_bits[1]]], self._ancilla)
182
+ # Force the syndrome non-pathological.
183
+ self.sim.force_m(self._ancilla, False)
184
+
155
185
 
156
186
  def u(self, th, ph, lm, lq):
157
187
  hq = self._unpack(lq)
158
188
  self._decode(hq)
159
189
  self.sim.u(hq[0], th, ph, lm)
160
190
  self._encode(hq)
161
- self._correct(lq)
162
191
 
163
192
  def r(self, p, th, lq):
164
193
  hq = self._unpack(lq)
165
194
  self._decode(hq)
166
195
  self.sim.r(p, th, hq[0])
167
196
  self._encode(hq)
168
- self._correct(lq)
169
197
 
170
198
  def s(self, lq):
171
199
  hq = self._unpack(lq)
172
200
  self._decode(hq)
173
201
  self.sim.s(hq[0])
174
202
  self._encode(hq)
175
- self._correct(lq)
176
203
 
177
204
  def adjs(self, lq):
178
205
  hq = self._unpack(lq)
179
206
  self._decode(hq)
180
207
  self.sim.adjs(hq[0])
181
208
  self._encode(hq)
182
- self._correct(lq)
183
209
 
184
210
  def x(self, lq):
185
211
  hq = self._unpack(lq)
186
212
  self._decode(hq)
187
213
  self.sim.x(hq[0])
188
214
  self._encode(hq)
189
- self._correct(lq)
190
215
 
191
216
  def y(self, lq):
192
217
  hq = self._unpack(lq)
193
218
  self._decode(hq)
194
219
  self.sim.y(hq[0])
195
220
  self._encode(hq)
196
- self._correct(lq)
197
221
 
198
222
  def z(self, lq):
199
223
  hq = self._unpack(lq)
200
224
  self._decode(hq)
201
225
  self.sim.z(hq[0])
202
226
  self._encode(hq)
203
- self._correct(lq)
204
227
 
205
228
  def h(self, lq):
206
229
  hq = self._unpack(lq)
207
230
  self._decode(hq)
208
231
  self.sim.h(hq[0])
209
232
  self._encode(hq)
210
- self._correct(lq)
211
233
 
212
234
  def t(self, lq):
213
235
  hq = self._unpack(lq)
214
236
  self._decode(hq)
215
237
  self.sim.t(hq[0])
216
238
  self._encode(hq)
217
- self._correct(lq)
218
239
 
219
240
  def adjt(self, lq):
220
241
  hq = self._unpack(lq)
221
242
  self._decode(hq)
222
243
  self.sim.adjt(hq[0])
223
244
  self._encode(hq)
224
- self._correct(lq)
225
245
 
226
246
  def _cpauli(self, lq1, lq2, anti, pauli):
247
+ self._correct(lq1)
248
+
227
249
  gate = None
228
250
  shadow = None
229
251
  if pauli == Pauli.PauliX:
@@ -271,9 +293,6 @@ class QrackAceBackend:
271
293
  gate([hq1[1]], hq2[1])
272
294
  gate([hq1[2]], hq2[2])
273
295
 
274
- self._correct(lq1)
275
- self._correct(lq2)
276
-
277
296
 
278
297
  def cx(self, lq1, lq2):
279
298
  self._cpauli(lq1, lq2, False, Pauli.PauliX)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyqrack-cuda
3
- Version: 1.44.13
3
+ Version: 1.44.15
4
4
  Summary: pyqrack - Pure Python vm6502q/qrack Wrapper
5
5
  Home-page: https://github.com/vm6502q/pyqrack
6
6
  Author: Daniel Strano
@@ -7,7 +7,7 @@ from setuptools import setup
7
7
  from setuptools.command.build_py import build_py
8
8
 
9
9
 
10
- VERSION = "1.44.13"
10
+ VERSION = "1.44.15"
11
11
 
12
12
  # Read long description from README.
13
13
  README_PATH = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'README.md')
File without changes
File without changes
File without changes
File without changes