pyqrack-cpu 1.52.7__py3-none-manylinux_2_39_x86_64.whl → 1.53.0__py3-none-manylinux_2_39_x86_64.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 pyqrack-cpu might be problematic. Click here for more details.

@@ -146,8 +146,7 @@ class QrackAceBackend:
146
146
  col_len -= 1
147
147
  row_len = width // col_len
148
148
 
149
- self.col_length = row_len if reverse else col_len
150
- self.row_length = col_len if reverse else row_len
149
+ self.col_length, self.row_length = (row_len, col_len) if reverse else (col_len, row_len)
151
150
 
152
151
  def _ct_pair_prob(self, q1, q2):
153
152
  p1 = self.sim[q1[0]].prob(q1[1])
@@ -220,25 +219,14 @@ class QrackAceBackend:
220
219
  self._qubit_dict[offset + 2],
221
220
  ]
222
221
 
223
- def _encode_decode(self, lq, hq):
222
+ def _encode_decode(self, hq):
224
223
  if len(hq) < 2:
225
224
  return
226
225
  if hq[0][0] == hq[1][0]:
227
- b0 = hq[0]
228
- self.sim[b0[0]].mcx([b0[1]], hq[1][1])
226
+ b = hq[0]
229
227
  else:
230
- b2 = hq[2]
231
- self.sim[b2[0]].mcx([b2[1]], hq[1][1])
232
-
233
- def _encode_decode_half(self, lq, hq, toward_0):
234
- if len(hq) < 2:
235
- return
236
- if toward_0 and (hq[0][0] == hq[1][0]):
237
- b0 = hq[0]
238
- self.sim[b0[0]].mcx([b0[1]], hq[1][1])
239
- elif not toward_0 and (hq[2][0] == hq[1][0]):
240
- b2 = hq[2]
241
- self.sim[b2[0]].mcx([b2[1]], hq[1][1])
228
+ b = hq[2]
229
+ self.sim[b[0]].mcx([b[1]], hq[1][1])
242
230
 
243
231
  def _correct(self, lq, phase=False):
244
232
  if self._is_col_long_range[lq % self.row_length]:
@@ -373,12 +361,12 @@ class QrackAceBackend:
373
361
 
374
362
  if not math.isclose(ph, -lm) and not math.isclose(abs(ph), math.pi / 2):
375
363
  # Produces/destroys superposition
376
- self._encode_decode(lq, hq)
364
+ self._encode_decode(hq)
377
365
  b = hq[0]
378
366
  self.sim[b[0]].u(b[1], th, ph, lm)
379
367
  b = hq[2]
380
368
  self.sim[b[0]].u(b[1], th, ph, lm)
381
- self._encode_decode(lq, hq)
369
+ self._encode_decode(hq)
382
370
  self._correct(lq)
383
371
  else:
384
372
  # Shouldn't produce/destroy superposition
@@ -402,12 +390,12 @@ class QrackAceBackend:
402
390
  self.sim[b[0]].r(p, th, b[1])
403
391
  else:
404
392
  # Produces/destroys superposition
405
- self._encode_decode(lq, hq)
393
+ self._encode_decode(hq)
406
394
  b = hq[0]
407
395
  self.sim[b[0]].r(p, th, b[1])
408
396
  b = hq[2]
409
397
  self.sim[b[0]].r(p, th, b[1])
410
- self._encode_decode(lq, hq)
398
+ self._encode_decode(hq)
411
399
  self._correct(lq)
412
400
 
413
401
  def h(self, lq):
@@ -417,12 +405,12 @@ class QrackAceBackend:
417
405
  self.sim[b[0]].h(b[1])
418
406
  return
419
407
 
420
- self._encode_decode(lq, hq)
408
+ self._encode_decode(hq)
421
409
  b = hq[0]
422
410
  self.sim[b[0]].h(b[1])
423
411
  b = hq[2]
424
412
  self.sim[b[0]].h(b[1])
425
- self._encode_decode(lq, hq)
413
+ self._encode_decode(hq)
426
414
  self._correct(lq)
427
415
 
428
416
  def s(self, lq):
@@ -555,66 +543,62 @@ class QrackAceBackend:
555
543
  shadow(b1, b2)
556
544
  return
557
545
 
546
+ self._correct(lq1)
547
+
558
548
  if (lq2_col in connected_cols) and (connected_cols.index(lq2_col) < boundary):
559
549
  # lq2_col < lq1_col
560
- self._encode_decode_half(lq1, hq1, True)
561
- self._encode_decode_half(lq2, hq2, False)
562
- b = hq1[0]
550
+ self._encode_decode(hq1)
551
+ self._encode_decode(hq2)
552
+ gate, shadow = self._get_gate(pauli, anti, hq1[0][0])
563
553
  if lq1_lr:
564
- self._get_gate(pauli, anti, hq1[0][0])[0]([b[1]], hq2[2][1])
554
+ gate([hq1[0][1]], hq2[2][1])
555
+ shadow(hq1[0], hq2[0])
565
556
  elif lq2_lr:
566
- self._get_gate(pauli, anti, hq2[0][0])[0]([b[1]], hq2[0][1])
557
+ gate([hq1[0][1]], hq2[0][1])
567
558
  else:
568
- self._get_gate(pauli, anti, b[0])[0]([b[1]], hq2[2][1])
569
- self._encode_decode_half(lq2, hq2, False)
570
- self._encode_decode_half(lq1, hq1, True)
559
+ gate([hq1[0][1]], hq2[2][1])
560
+ shadow(hq1[2], hq2[0])
561
+ self._encode_decode(hq2)
562
+ self._encode_decode(hq1)
571
563
  elif lq2_col in connected_cols:
572
564
  # lq1_col < lq2_col
573
- self._encode_decode_half(lq1, hq1, False)
574
- self._encode_decode_half(lq2, hq2, True)
575
- b = hq2[0]
565
+ self._encode_decode(hq1)
566
+ self._encode_decode(hq2)
567
+ gate, shadow = self._get_gate(pauli, anti, hq2[0][0])
576
568
  if lq1_lr:
577
- self._get_gate(pauli, anti, hq1[0][0])[0]([hq1[0][1]], b[1])
569
+ gate([hq1[0][1]], hq2[0][1])
570
+ shadow(hq1[0], hq2[2])
578
571
  elif lq2_lr:
579
- self._get_gate(pauli, anti, hq2[0][0])[0]([hq1[2][1]], b[1])
572
+ gate([hq1[2][1]], hq2[0][1])
580
573
  else:
581
- self._get_gate(pauli, anti, b[0])[0]([hq1[2][1]], b[1])
582
- self._encode_decode_half(lq2, hq2, True)
583
- self._encode_decode_half(lq1, hq1, False)
574
+ gate([hq1[2][1]], hq2[0][1])
575
+ shadow(hq1[0], hq2[2])
576
+ self._encode_decode(hq2)
577
+ self._encode_decode(hq1)
584
578
  elif lq1_col == lq2_col:
585
579
  # Both are in the same boundary column.
580
+ self._encode_decode(hq1)
581
+ self._encode_decode(hq2)
586
582
  b = hq1[0]
587
583
  gate, shadow = self._get_gate(pauli, anti, b[0])
588
584
  gate([b[1]], hq2[0][1])
589
- if (lq1_row & 1) == (lq2_row & 1):
590
- b = hq1[1]
591
- gate, shadow = self._get_gate(pauli, anti, b[0])
592
- gate([b[1]], hq2[1][1])
593
- else:
594
- shadow(hq1[1], hq2[1])
595
585
  b = hq1[2]
596
586
  gate, shadow = self._get_gate(pauli, anti, b[0])
597
587
  gate([b[1]], hq2[2][1])
588
+ self._encode_decode(hq1)
589
+ self._encode_decode(hq2)
598
590
  else:
599
591
  # The qubits have no quantum connection.
600
592
  gate, shadow = self._get_gate(pauli, anti, hq1[0][0])
593
+ self._encode_decode(hq1)
594
+ self._encode_decode(hq2)
595
+ shadow(hq1[0], hq2[0])
601
596
  if lq1_lr:
602
- connected01 = (hq2[0][0] == hq2[1][0])
603
- self._encode_decode(lq2, hq2)
604
- shadow(hq1[0], hq2[0] if connected01 else hq2[2])
605
- self._encode_decode(lq2, hq2)
606
- elif lq2_lr:
607
- connected01 = (hq1[0][0] == hq1[1][0])
608
- self._encode_decode(lq1, hq1)
609
- shadow(hq1[0] if connected01 else hq1[2], hq2[0])
610
- self._encode_decode(lq1, hq1)
611
- else:
612
- self._encode_decode(lq1, hq1)
613
- self._encode_decode(lq2, hq2)
614
- shadow(hq1[0], hq2[0])
597
+ shadow(hq1[0], hq2[2])
598
+ elif not lq2_lr:
615
599
  shadow(hq1[2], hq2[2])
616
- self._encode_decode(lq2, hq2)
617
- self._encode_decode(lq1, hq1)
600
+ self._encode_decode(hq2)
601
+ self._encode_decode(hq1)
618
602
 
619
603
  self._correct(lq1, True)
620
604
  if pauli != Pauli.PauliZ:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyqrack-cpu
3
- Version: 1.52.7
3
+ Version: 1.53.0
4
4
  Summary: pyqrack - Pure Python vm6502q/qrack Wrapper
5
5
  Home-page: https://github.com/vm6502q/pyqrack
6
6
  Author: Daniel Strano
@@ -62,10 +62,6 @@ This is the **purely CPU-based** variant of PyQrack (with module name `pyqrack-c
62
62
 
63
63
  **If you're looking for Mac ARM support, use the package `pyqrack`, not `pyqrack-cpu`.** Mac officially "deprecated" OpenCL years ago. Hence, accelerator support is not included in ARM-based Mac wheels, and OpenCL installation is **not** required on these systems, but, if you have a CUDA accelerator on ARM-based Mac, you could try the package `pyqrack-cuda` instead.
64
64
 
65
- (**If you installing from source,** it doesn't matter whether you use `pyqrack` or `pyqrack-cpu`, because the build version of C++ Qrack you intend to use must already be installed locally.)
66
-
67
- **If you're looking for Mac ARM support, use the package `pyqrack`, not `pyqrack-cpu`.** Mac officially "deprecated" OpenCL years ago. Hence, accelerator support is not included in ARM-based Mac wheels, and OpenCL installation is **not** required on these systems, but, if you have a CUDA accelerator on ARM-based Mac, you could try the package `pyqrack-cuda` instead.
68
-
69
65
  **Performance can benefit greatly from following the [Qrack repository "Quick Start" and "Power user considerations."](https://github.com/unitaryfund/qrack/blob/main/README.md#quick-start)**
70
66
 
71
67
  Import and instantiate [`QrackSimulator`](https://github.com/unitaryfund/pyqrack/blob/main/pyqrack/qrack_simulator.py) instances. This simulator can perform arbitrary single qubit and controlled-single-qubit gates, as well as other specific gates like `SWAP`.
@@ -1,7 +1,7 @@
1
1
  pyqrack/__init__.py,sha256=3tBwfCCD-zQjQ2g1EUZdggKdn-3b2uSFTbT7LS0YLaU,785
2
2
  pyqrack/neuron_activation_fn.py,sha256=fQTTFfsvwcot_43Vopacot47IV2Rxk8pelUyuzwpXPs,593
3
3
  pyqrack/pauli.py,sha256=wg500wDOwdIU4lEVJoMmjtbAdmtakZYzLPjdzC2rwUQ,654
4
- pyqrack/qrack_ace_backend.py,sha256=8y98Pxe67IImNVsuzgPF1yofMTK0XeESV0qCpdOBXv4,42305
4
+ pyqrack/qrack_ace_backend.py,sha256=cklm--ClsdlngSyTmVKkuDNfI72UwHUCafgmks3SINc,41279
5
5
  pyqrack/qrack_circuit.py,sha256=vDCKGbcEHJDFUKprjCpWgit8lXFnMrPimKHURD2_Hj4,19538
6
6
  pyqrack/qrack_neuron.py,sha256=UiJdjAGB6usjAGHWSosSFCUUeIkhh3MtZbsaxfsIsNw,9043
7
7
  pyqrack/qrack_neuron_torch_layer.py,sha256=Bs5BLC2GFevfSpo_jSJ2AZl-hfDRJmzlGN9pFw1CtoQ,6160
@@ -15,8 +15,8 @@ pyqrack/qrack_system/qrack_lib/libqrack_pinvoke.so.9.20.0,sha256=JFdxEoymJQvL6_Z
15
15
  pyqrack/stats/__init__.py,sha256=Hla85my2fY_roR9lIjGBVpEG7ySOTMwjWa8D6-kgCnY,276
16
16
  pyqrack/stats/load_quantized_data.py,sha256=z12u9F7Nt3P-i44nY1xxvso_klS6WIHS3iqq7R2_lqE,1184
17
17
  pyqrack/stats/quantize_by_range.py,sha256=UM0_7jJDdQ7g30cR3UQAxkbzkqrmsy1oUfqg0h11FUY,2270
18
- pyqrack_cpu-1.52.7.dist-info/licenses/LICENSE,sha256=HxB-7SaWTuewAk1nz-3_3FUD6QhgX73kNT_taKVUTq8,1069
19
- pyqrack_cpu-1.52.7.dist-info/METADATA,sha256=OIZsOf1RrdzKNOrCyAdEuLVERLExnZriTOUk7zfl9Mk,6702
20
- pyqrack_cpu-1.52.7.dist-info/WHEEL,sha256=k8EuOMBHdXsN9XSTE5LrpwS4FtdLkoSlyO_7W-lE_zg,109
21
- pyqrack_cpu-1.52.7.dist-info/top_level.txt,sha256=YE_3q9JTGRLMilNg2tGP1y7uU-Dx8PDao2OhwoIbv8E,8
22
- pyqrack_cpu-1.52.7.dist-info/RECORD,,
18
+ pyqrack_cpu-1.53.0.dist-info/licenses/LICENSE,sha256=HxB-7SaWTuewAk1nz-3_3FUD6QhgX73kNT_taKVUTq8,1069
19
+ pyqrack_cpu-1.53.0.dist-info/METADATA,sha256=BcZj2O6v3ej9MpvWex_OH0uCG4lfgry65nl-16B31bg,6140
20
+ pyqrack_cpu-1.53.0.dist-info/WHEEL,sha256=k8EuOMBHdXsN9XSTE5LrpwS4FtdLkoSlyO_7W-lE_zg,109
21
+ pyqrack_cpu-1.53.0.dist-info/top_level.txt,sha256=YE_3q9JTGRLMilNg2tGP1y7uU-Dx8PDao2OhwoIbv8E,8
22
+ pyqrack_cpu-1.53.0.dist-info/RECORD,,