pyqrack-complex128 2.24.0__tar.gz → 2.25.0__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 (30) hide show
  1. {pyqrack_complex128-2.24.0/pyqrack_complex128.egg-info → pyqrack_complex128-2.25.0}/PKG-INFO +1 -1
  2. {pyqrack_complex128-2.24.0 → pyqrack_complex128-2.25.0}/pyqrack/qrack_ace_backend.py +101 -2
  3. {pyqrack_complex128-2.24.0 → pyqrack_complex128-2.25.0/pyqrack_complex128.egg-info}/PKG-INFO +1 -1
  4. {pyqrack_complex128-2.24.0 → pyqrack_complex128-2.25.0}/setup.py +1 -1
  5. {pyqrack_complex128-2.24.0 → pyqrack_complex128-2.25.0}/LICENSE +0 -0
  6. {pyqrack_complex128-2.24.0 → pyqrack_complex128-2.25.0}/MANIFEST.in +0 -0
  7. {pyqrack_complex128-2.24.0 → pyqrack_complex128-2.25.0}/Makefile +0 -0
  8. {pyqrack_complex128-2.24.0 → pyqrack_complex128-2.25.0}/README.md +0 -0
  9. {pyqrack_complex128-2.24.0 → pyqrack_complex128-2.25.0}/pyproject.toml +0 -0
  10. {pyqrack_complex128-2.24.0 → pyqrack_complex128-2.25.0}/pyqrack/__init__.py +0 -0
  11. {pyqrack_complex128-2.24.0 → pyqrack_complex128-2.25.0}/pyqrack/neuron_activation_fn.py +0 -0
  12. {pyqrack_complex128-2.24.0 → pyqrack_complex128-2.25.0}/pyqrack/pauli.py +0 -0
  13. {pyqrack_complex128-2.24.0 → pyqrack_complex128-2.25.0}/pyqrack/qrack_circuit.py +0 -0
  14. {pyqrack_complex128-2.24.0 → pyqrack_complex128-2.25.0}/pyqrack/qrack_near_clifford_qec_backend.py +0 -0
  15. {pyqrack_complex128-2.24.0 → pyqrack_complex128-2.25.0}/pyqrack/qrack_neuron.py +0 -0
  16. {pyqrack_complex128-2.24.0 → pyqrack_complex128-2.25.0}/pyqrack/qrack_neuron_torch_layer.py +0 -0
  17. {pyqrack_complex128-2.24.0 → pyqrack_complex128-2.25.0}/pyqrack/qrack_simulator.py +0 -0
  18. {pyqrack_complex128-2.24.0 → pyqrack_complex128-2.25.0}/pyqrack/qrack_stabilizer.py +0 -0
  19. {pyqrack_complex128-2.24.0 → pyqrack_complex128-2.25.0}/pyqrack/qrack_system/__init__.py +0 -0
  20. {pyqrack_complex128-2.24.0 → pyqrack_complex128-2.25.0}/pyqrack/qrack_system/qrack_system.py +0 -0
  21. {pyqrack_complex128-2.24.0 → pyqrack_complex128-2.25.0}/pyqrack/quimb_circuit_type.py +0 -0
  22. {pyqrack_complex128-2.24.0 → pyqrack_complex128-2.25.0}/pyqrack/stats/__init__.py +0 -0
  23. {pyqrack_complex128-2.24.0 → pyqrack_complex128-2.25.0}/pyqrack/stats/load_quantized_data.py +0 -0
  24. {pyqrack_complex128-2.24.0 → pyqrack_complex128-2.25.0}/pyqrack/stats/quantize_by_range.py +0 -0
  25. {pyqrack_complex128-2.24.0 → pyqrack_complex128-2.25.0}/pyqrack_complex128.egg-info/SOURCES.txt +0 -0
  26. {pyqrack_complex128-2.24.0 → pyqrack_complex128-2.25.0}/pyqrack_complex128.egg-info/dependency_links.txt +0 -0
  27. {pyqrack_complex128-2.24.0 → pyqrack_complex128-2.25.0}/pyqrack_complex128.egg-info/not-zip-safe +0 -0
  28. {pyqrack_complex128-2.24.0 → pyqrack_complex128-2.25.0}/pyqrack_complex128.egg-info/requires.txt +0 -0
  29. {pyqrack_complex128-2.24.0 → pyqrack_complex128-2.25.0}/pyqrack_complex128.egg-info/top_level.txt +0 -0
  30. {pyqrack_complex128-2.24.0 → pyqrack_complex128-2.25.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyqrack-complex128
3
- Version: 2.24.0
3
+ Version: 2.25.0
4
4
  Summary: pyqrack - Pure Python vm6502q/qrack Wrapper
5
5
  Home-page: https://github.com/vm6502q/pyqrack
6
6
  Author: Daniel Strano
@@ -408,12 +408,18 @@ class QrackAceBackend:
408
408
  # per-simulator allocation above.
409
409
  self._detect_ancilla1 = []
410
410
  self._detect_ancilla2 = []
411
+ self._detect_ancilla3 = []
412
+ self._detect_ancilla4 = []
411
413
  if self.is_error_detection:
412
414
  for i in range(len(sim_counts)):
413
415
  self._detect_ancilla1.append(sim_counts[i])
414
416
  sim_counts[i] += 1
415
417
  self._detect_ancilla2.append(sim_counts[i])
416
418
  sim_counts[i] += 1
419
+ self._detect_ancilla3.append(sim_counts[i])
420
+ sim_counts[i] += 1
421
+ self._detect_ancilla4.append(sim_counts[i])
422
+ sim_counts[i] += 1
417
423
 
418
424
  # Logical-qubit wrapper around each patch's detection ancilla,
419
425
  # so it's addressable via the ORDINARY cx()/_cpauli() machinery
@@ -435,6 +441,8 @@ class QrackAceBackend:
435
441
  # legitimately need to change any single replica's own value.
436
442
  self._detect_ancilla1_lq = []
437
443
  self._detect_ancilla2_lq = []
444
+ self._detect_ancilla3_lq = []
445
+ self._detect_ancilla4_lq = []
438
446
  if self.is_error_detection:
439
447
  for sim_id, phys_idx in enumerate(self._detect_ancilla1):
440
448
  lq_idx = len(self._qubits)
@@ -444,6 +452,14 @@ class QrackAceBackend:
444
452
  lq_idx = len(self._qubits)
445
453
  self._qubits.append([(sim_id, phys_idx)])
446
454
  self._detect_ancilla2_lq.append(lq_idx)
455
+ for sim_id, phys_idx in enumerate(self._detect_ancilla3):
456
+ lq_idx = len(self._qubits)
457
+ self._qubits.append([(sim_id, phys_idx)])
458
+ self._detect_ancilla3_lq.append(lq_idx)
459
+ for sim_id, phys_idx in enumerate(self._detect_ancilla4):
460
+ lq_idx = len(self._qubits)
461
+ self._qubits.append([(sim_id, phys_idx)])
462
+ self._detect_ancilla4_lq.append(lq_idx)
447
463
  # Boundary repetition code, on-demand design: only the couplers
448
464
  # are actually noisy here -- single-qubit gates are already
449
465
  # exactly transversal, per-replica, with zero error, so there's
@@ -2353,6 +2369,87 @@ class QrackAceBackend:
2353
2369
  self.cz(lq1, lq2)
2354
2370
  self.swap(lq1, lq2)
2355
2371
 
2372
+ def ccx(self, c1, c2, t):
2373
+ hq1 = self._unpack(c1)
2374
+ hq2 = self._unpack(c2)
2375
+ hqt = self._unpack(t)
2376
+
2377
+ if (len(hqt) == 1) and (len(hq1) == 1) and (len(hq2) == 1) and (hqt[0][0] == hq1[0][0]) and (hqt[0][0] == hq2[0][0]):
2378
+ self.mcx([c1, c2], t)
2379
+ return
2380
+
2381
+ anc1, anc2 = None, None
2382
+ if self.is_error_detection and not self._in_gadget_capture and (len(hqt) == 1) and ((len(hq1) > 1) or (len(hq2) > 1)):
2383
+ anc1 = self._detect_ancilla3_lq[hqt[0][0]]
2384
+ anc2 = self._detect_ancilla4_lq[hqt[0][0]]
2385
+ self._in_gadget_capture = True
2386
+ self.cx(t, anc1)
2387
+ self.cx(c1, anc1)
2388
+ self.cx(c2, anc1)
2389
+ self.cx(t, anc2)
2390
+ self.cx(c2, anc2)
2391
+ self.cx(c1, anc2)
2392
+ self._in_gadget_capture = False
2393
+
2394
+ # CCNOT decomposition
2395
+ self.h(t)
2396
+ self.cx(c2, t)
2397
+ self.adjt(t)
2398
+ self.cx(c1, t)
2399
+ self.t(t)
2400
+ self.cx(c2, t)
2401
+ self.adjt(t)
2402
+ self.cx(c1, t)
2403
+ self.t(t)
2404
+ self.h(t)
2405
+ self.t(c2)
2406
+ self.cx(c1, c2)
2407
+ self.t(c1)
2408
+ self.adjt(c2)
2409
+ self.cx(c1, c2)
2410
+
2411
+ if anc1 is not None:
2412
+ # Syndrome
2413
+ self.cx(t, anc1)
2414
+ self.cx(c2, anc1)
2415
+ self.cx(t, anc2)
2416
+ self.cx(c1, anc2)
2417
+
2418
+ # Post-selection
2419
+ anc_sim, anc_idx = self._qubits[anc1][0]
2420
+ p = self.sim[anc_sim].prob(anc_idx)
2421
+ if self._ps_epsilon >= (1.0 - p):
2422
+ b1 = self.m(anc1)
2423
+ else:
2424
+ b1 = self.force_m(anc1, False)
2425
+ if b1:
2426
+ self.x(anc1)
2427
+
2428
+ anc_sim, anc_idx = self._qubits[anc2][0]
2429
+ p = self.sim[anc_sim].prob(anc_idx)
2430
+ if b1:
2431
+ p = 1.0 - p
2432
+ if self._ps_epsilon >= (1.0 - p):
2433
+ b2 = self.m(anc2)
2434
+ else:
2435
+ b2 = self.force_m(anc2, b1)
2436
+ if b2:
2437
+ self.x(anc2)
2438
+
2439
+ # Correction gate
2440
+ if b1 or b2:
2441
+ self.x(t)
2442
+
2443
+ def ccz(self, c1, c2, t):
2444
+ self.h(t)
2445
+ self.ccx(c1, c2, t)
2446
+ self.h(t)
2447
+
2448
+ def ccy(self, c1, c2, t):
2449
+ self.adjs(t)
2450
+ self.ccx(c1, c2, t)
2451
+ self.s(t)
2452
+
2356
2453
  def prob(self, lq):
2357
2454
  hq = self._unpack(lq)
2358
2455
  if len(hq) < 2:
@@ -2573,9 +2670,11 @@ class QrackAceBackend:
2573
2670
  elif name == "cz":
2574
2671
  self._sim.cz(operation.qubits[0]._index, operation.qubits[1]._index)
2575
2672
  elif name == "ccx":
2576
- self._sim.mcx([operation.qubits[0]._index, operation.qubits[1]._index], operation.qubits[2]._index)
2673
+ self._sim.ccx(operation.qubits[0]._index, operation.qubits[1]._index, operation.qubits[2]._index)
2674
+ elif name == "ccy":
2675
+ self._sim.ccy(operation.qubits[0]._index, operation.qubits[1]._index, operation.qubits[2]._index)
2577
2676
  elif name == "ccz":
2578
- self._sim.mcz([operation.qubits[0]._index, operation.qubits[1]._index], operation.qubits[2]._index)
2677
+ self._sim.ccz(operation.qubits[0]._index, operation.qubits[1]._index, operation.qubits[2]._index)
2579
2678
  elif name == "mcx":
2580
2679
  self._sim.mcx([q._index for q in operation.qubits[:-1]], operation.qubits[-1]._index)
2581
2680
  elif name == "mcy":
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyqrack-complex128
3
- Version: 2.24.0
3
+ Version: 2.25.0
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 = "2.24.0"
10
+ VERSION = "2.25.0"
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')