pyqrack-cuda 1.44.11__tar.gz → 1.44.13__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.11/pyqrack_cuda.egg-info → pyqrack_cuda-1.44.13}/PKG-INFO +1 -1
  2. {pyqrack_cuda-1.44.11 → pyqrack_cuda-1.44.13}/pyqrack/qrack_ace_backend.py +52 -1
  3. {pyqrack_cuda-1.44.11 → pyqrack_cuda-1.44.13/pyqrack_cuda.egg-info}/PKG-INFO +1 -1
  4. {pyqrack_cuda-1.44.11 → pyqrack_cuda-1.44.13}/setup.py +1 -1
  5. {pyqrack_cuda-1.44.11 → pyqrack_cuda-1.44.13}/LICENSE +0 -0
  6. {pyqrack_cuda-1.44.11 → pyqrack_cuda-1.44.13}/MANIFEST.in +0 -0
  7. {pyqrack_cuda-1.44.11 → pyqrack_cuda-1.44.13}/Makefile +0 -0
  8. {pyqrack_cuda-1.44.11 → pyqrack_cuda-1.44.13}/README.md +0 -0
  9. {pyqrack_cuda-1.44.11 → pyqrack_cuda-1.44.13}/pyproject.toml +0 -0
  10. {pyqrack_cuda-1.44.11 → pyqrack_cuda-1.44.13}/pyqrack/__init__.py +0 -0
  11. {pyqrack_cuda-1.44.11 → pyqrack_cuda-1.44.13}/pyqrack/neuron_activation_fn.py +0 -0
  12. {pyqrack_cuda-1.44.11 → pyqrack_cuda-1.44.13}/pyqrack/pauli.py +0 -0
  13. {pyqrack_cuda-1.44.11 → pyqrack_cuda-1.44.13}/pyqrack/qrack_circuit.py +0 -0
  14. {pyqrack_cuda-1.44.11 → pyqrack_cuda-1.44.13}/pyqrack/qrack_neuron.py +0 -0
  15. {pyqrack_cuda-1.44.11 → pyqrack_cuda-1.44.13}/pyqrack/qrack_neuron_torch_layer.py +0 -0
  16. {pyqrack_cuda-1.44.11 → pyqrack_cuda-1.44.13}/pyqrack/qrack_simulator.py +0 -0
  17. {pyqrack_cuda-1.44.11 → pyqrack_cuda-1.44.13}/pyqrack/qrack_stabilizer.py +0 -0
  18. {pyqrack_cuda-1.44.11 → pyqrack_cuda-1.44.13}/pyqrack/qrack_system/__init__.py +0 -0
  19. {pyqrack_cuda-1.44.11 → pyqrack_cuda-1.44.13}/pyqrack/qrack_system/qrack_system.py +0 -0
  20. {pyqrack_cuda-1.44.11 → pyqrack_cuda-1.44.13}/pyqrack/quimb_circuit_type.py +0 -0
  21. {pyqrack_cuda-1.44.11 → pyqrack_cuda-1.44.13}/pyqrack/stats/__init__.py +0 -0
  22. {pyqrack_cuda-1.44.11 → pyqrack_cuda-1.44.13}/pyqrack/stats/load_quantized_data.py +0 -0
  23. {pyqrack_cuda-1.44.11 → pyqrack_cuda-1.44.13}/pyqrack/stats/quantize_by_range.py +0 -0
  24. {pyqrack_cuda-1.44.11 → pyqrack_cuda-1.44.13}/pyqrack_cuda.egg-info/SOURCES.txt +0 -0
  25. {pyqrack_cuda-1.44.11 → pyqrack_cuda-1.44.13}/pyqrack_cuda.egg-info/dependency_links.txt +0 -0
  26. {pyqrack_cuda-1.44.11 → pyqrack_cuda-1.44.13}/pyqrack_cuda.egg-info/not-zip-safe +0 -0
  27. {pyqrack_cuda-1.44.11 → pyqrack_cuda-1.44.13}/pyqrack_cuda.egg-info/requires.txt +0 -0
  28. {pyqrack_cuda-1.44.11 → pyqrack_cuda-1.44.13}/pyqrack_cuda.egg-info/top_level.txt +0 -0
  29. {pyqrack_cuda-1.44.11 → pyqrack_cuda-1.44.13}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyqrack-cuda
3
- Version: 1.44.11
3
+ Version: 1.44.13
4
4
  Summary: pyqrack - Pure Python vm6502q/qrack Wrapper
5
5
  Home-page: https://github.com/vm6502q/pyqrack
6
6
  Author: Daniel Strano
@@ -39,7 +39,8 @@ class QrackAceBackend:
39
39
  """
40
40
 
41
41
  def __init__(self, qubit_count=-1, alternating_codes=True, toClone=None):
42
- self.sim = toClone.sim.clone() if toClone else QrackSimulator(3 * qubit_count)
42
+ self.sim = toClone.sim.clone() if toClone else QrackSimulator(3 * qubit_count + 1)
43
+ self._ancilla = 3 * qubit_count
43
44
  self._factor_width(qubit_count)
44
45
  self.alternating_codes = alternating_codes
45
46
 
@@ -118,65 +119,109 @@ class QrackAceBackend:
118
119
  self._cx_shadow(hq[1], hq[2])
119
120
  self.sim.mcx([hq[0]], hq[1])
120
121
 
122
+ def _correct(self, lq):
123
+ hq = self._unpack(lq)
124
+ shots = 1024
125
+ samples = self.sim.measure_shots(hq, shots)
126
+ syndrome = [0, 0, 0]
127
+ for sample in samples:
128
+ match sample:
129
+ case 1:
130
+ syndrome[0] += 1
131
+ case 2:
132
+ syndrome[1] += 1
133
+ case 4:
134
+ syndrome[2] += 1
135
+ case 6:
136
+ syndrome[0] += 1
137
+ case 5:
138
+ syndrome[1] += 1
139
+ case 3:
140
+ syndrome[2] += 1
141
+ 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
147
+ if error_bit == single_bit:
148
+ self.sim.x(hq[error_bit])
149
+ else:
150
+ self.sim.mcx([hq[1]], self._ancilla)
151
+ self.sim.mcx([hq[2]], self._ancilla)
152
+ self.sim.force_m(self._ancilla, True)
153
+ self.sim.x(hq[error_bit])
154
+
155
+
121
156
  def u(self, th, ph, lm, lq):
122
157
  hq = self._unpack(lq)
123
158
  self._decode(hq)
124
159
  self.sim.u(hq[0], th, ph, lm)
125
160
  self._encode(hq)
161
+ self._correct(lq)
126
162
 
127
163
  def r(self, p, th, lq):
128
164
  hq = self._unpack(lq)
129
165
  self._decode(hq)
130
166
  self.sim.r(p, th, hq[0])
131
167
  self._encode(hq)
168
+ self._correct(lq)
132
169
 
133
170
  def s(self, lq):
134
171
  hq = self._unpack(lq)
135
172
  self._decode(hq)
136
173
  self.sim.s(hq[0])
137
174
  self._encode(hq)
175
+ self._correct(lq)
138
176
 
139
177
  def adjs(self, lq):
140
178
  hq = self._unpack(lq)
141
179
  self._decode(hq)
142
180
  self.sim.adjs(hq[0])
143
181
  self._encode(hq)
182
+ self._correct(lq)
144
183
 
145
184
  def x(self, lq):
146
185
  hq = self._unpack(lq)
147
186
  self._decode(hq)
148
187
  self.sim.x(hq[0])
149
188
  self._encode(hq)
189
+ self._correct(lq)
150
190
 
151
191
  def y(self, lq):
152
192
  hq = self._unpack(lq)
153
193
  self._decode(hq)
154
194
  self.sim.y(hq[0])
155
195
  self._encode(hq)
196
+ self._correct(lq)
156
197
 
157
198
  def z(self, lq):
158
199
  hq = self._unpack(lq)
159
200
  self._decode(hq)
160
201
  self.sim.z(hq[0])
161
202
  self._encode(hq)
203
+ self._correct(lq)
162
204
 
163
205
  def h(self, lq):
164
206
  hq = self._unpack(lq)
165
207
  self._decode(hq)
166
208
  self.sim.h(hq[0])
167
209
  self._encode(hq)
210
+ self._correct(lq)
168
211
 
169
212
  def t(self, lq):
170
213
  hq = self._unpack(lq)
171
214
  self._decode(hq)
172
215
  self.sim.t(hq[0])
173
216
  self._encode(hq)
217
+ self._correct(lq)
174
218
 
175
219
  def adjt(self, lq):
176
220
  hq = self._unpack(lq)
177
221
  self._decode(hq)
178
222
  self.sim.adjt(hq[0])
179
223
  self._encode(hq)
224
+ self._correct(lq)
180
225
 
181
226
  def _cpauli(self, lq1, lq2, anti, pauli):
182
227
  gate = None
@@ -198,6 +243,8 @@ class QrackAceBackend:
198
243
  lq2_col = lq2 // self.row_length
199
244
  lq2_row = lq2 % self.row_length
200
245
 
246
+ hq1 = None
247
+ hq2 = None
201
248
  if (lq2_col == lq1_col) and (((lq1_row + 1) % self.row_length) == lq2_row):
202
249
  hq1 = self._unpack(lq1, True)
203
250
  hq2 = self._unpack(lq2, False)
@@ -224,6 +271,10 @@ class QrackAceBackend:
224
271
  gate([hq1[1]], hq2[1])
225
272
  gate([hq1[2]], hq2[2])
226
273
 
274
+ self._correct(lq1)
275
+ self._correct(lq2)
276
+
277
+
227
278
  def cx(self, lq1, lq2):
228
279
  self._cpauli(lq1, lq2, False, Pauli.PauliX)
229
280
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyqrack-cuda
3
- Version: 1.44.11
3
+ Version: 1.44.13
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.11"
10
+ VERSION = "1.44.13"
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