pyqrack-cpu 1.34.0__py3-none-manylinux_2_35_x86_64.whl → 1.34.4__py3-none-manylinux_2_35_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.

pyqrack/qrack_circuit.py CHANGED
@@ -385,6 +385,18 @@ class QrackCircuit:
385
385
 
386
386
  return circ
387
387
 
388
+ def _u3_to_mtrx(params):
389
+ th = float(params[0])
390
+ ph = float(params[1])
391
+ lm = float(params[2])
392
+
393
+ c = math.cos(th / 2)
394
+ s = math.sin(th / 2)
395
+ el = np.exp(1j * lm)
396
+ ep = np.exp(1j * ph)
397
+
398
+ return [ c + 0j, -el * s, ep * s, el * ep * c]
399
+
388
400
  def in_from_qiskit_circuit(circ):
389
401
  """Read a Qiskit circuit into a QrackCircuit
390
402
 
@@ -404,29 +416,26 @@ class QrackCircuit:
404
416
 
405
417
  out = QrackCircuit()
406
418
 
407
- basis_gates = ["u", "cx"]
408
- circ = transpile(circ, basis_gates=basis_gates, optimization_level=3)
419
+ basis_gates = ["x", "y", "z", "u", "cx", "cy", "cz", "cu"]
420
+ circ = transpile(circ, basis_gates=basis_gates, optimization_level=0)
409
421
  for gate in circ.data:
410
422
  o = gate.operation
411
- if o.name == "u":
412
- th = float(o.params[0])
413
- ph = float(o.params[1])
414
- lm = float(o.params[2])
415
-
416
- c = math.cos(th / 2)
417
- s = math.sin(th / 2)
418
-
419
- op = [
420
- c + 0j,
421
- -np.exp(1j * lm) * s,
422
- np.exp(1j * ph) * s,
423
- np.exp(1j * (ph + lm)) * c
424
- ]
423
+ op = []
424
+ if o.name in ["x", "cx"]:
425
+ op = [0, 1, 1, 0]
426
+ elif o.name in ["y", "cy"]:
427
+ op = [0, -1j, 1j, 0]
428
+ elif o.name in ["z", "cz"]:
429
+ op = [1, 0, 0, -1]
430
+ else:
431
+ op = QrackCircuit._u3_to_mtrx(o.params)
432
+ if o.name in ["x", "y", "z", "u"]:
425
433
  out.mtrx(op, circ.find_bit(gate.qubits[0])[0])
426
434
  else:
427
435
  ctrls = []
428
436
  for c in gate.qubits[0:1]:
429
437
  ctrls.append(circ.find_bit(c)[0])
438
+
430
439
  out.ucmtrx(ctrls, [0, 1, 1, 0], circ.find_bit(gate.qubits[1])[0], 1)
431
440
 
432
441
  return out
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyqrack-cpu
3
- Version: 1.34.0
3
+ Version: 1.34.4
4
4
  Summary: pyqrack - Pure Python vm6502q/qrack Wrapper
5
5
  Home-page: https://github.com/vm6502q/pyqrack
6
6
  Author: Daniel Strano
@@ -1,7 +1,7 @@
1
1
  pyqrack/__init__.py,sha256=OnxLLs0PUKiAqiGvMSbCDDYQvbshMyX2H0dy5RoAaCo,581
2
2
  pyqrack/neuron_activation_fn.py,sha256=xpL5MLEOi4FwAI3XZbtvdzM_5nan02yDnvO_tH4chVM,594
3
3
  pyqrack/pauli.py,sha256=DPvdqrz6w6M35f87sFYhwiQULrTThy2Nxd_CKp7EfXo,654
4
- pyqrack/qrack_circuit.py,sha256=MK8oN5h28OyS6ec04MoOy4Suk4CTSr83D09ZDjlNkAU,20338
4
+ pyqrack/qrack_circuit.py,sha256=kwID1P0IDbraPOWydajjMfDePIdskLfTxw8PDZ645n0,20605
5
5
  pyqrack/qrack_neuron.py,sha256=8i5oIxmf9IxTcBz7QRdhK4ABM2m2_N8ktR4pj6ALg0k,8842
6
6
  pyqrack/qrack_simulator.py,sha256=IdDsGRGazD3NBm0G_crrt8UcwKPHaLwv6LCzzYD9D24,133186
7
7
  pyqrack/quimb_circuit_type.py,sha256=UDiojIfsPQCsBFGekEsbg8t1j11cz4e4Kg7OetkFNfk,621
@@ -11,8 +11,8 @@ pyqrack/qrack_system/qrack_lib/libqrack_pinvoke.so,sha256=D0ryd9jPY2KW_vfaHYyM-k
11
11
  pyqrack/qrack_system/qrack_lib/libqrack_pinvoke.so.9.13.6,sha256=D0ryd9jPY2KW_vfaHYyM-ki0bOeW5Pkc7tx1Q1ZpBAg,3416472
12
12
  pyqrack/util/__init__.py,sha256=8ruN0efivTWkGQUevXnd0qvC9k36LJjJNf2f39Zc5jc,333
13
13
  pyqrack/util/convert_qiskit_circuit_to_qasm_experiment.py,sha256=omp5MxOa8m5H0cyClFGCLlTacNu5K9ezKbitwqABu0U,2065
14
- pyqrack_cpu-1.34.0.dist-info/LICENSE,sha256=HxB-7SaWTuewAk1nz-3_3FUD6QhgX73kNT_taKVUTq8,1069
15
- pyqrack_cpu-1.34.0.dist-info/METADATA,sha256=tb0T0uFCpM-UmFSMFKWB1lQb72cGyCh0dvlGcGJDLgo,5882
16
- pyqrack_cpu-1.34.0.dist-info/WHEEL,sha256=AMMNaGlKLEICDqgnxZojk7k8N6wUjQQ3X9tPjxJ2sOc,110
17
- pyqrack_cpu-1.34.0.dist-info/top_level.txt,sha256=YE_3q9JTGRLMilNg2tGP1y7uU-Dx8PDao2OhwoIbv8E,8
18
- pyqrack_cpu-1.34.0.dist-info/RECORD,,
14
+ pyqrack_cpu-1.34.4.dist-info/LICENSE,sha256=HxB-7SaWTuewAk1nz-3_3FUD6QhgX73kNT_taKVUTq8,1069
15
+ pyqrack_cpu-1.34.4.dist-info/METADATA,sha256=HxVOwhzcewAJ-aVW0sUyeXTs5NMFotNutUk0dFzlA1Y,5882
16
+ pyqrack_cpu-1.34.4.dist-info/WHEEL,sha256=AMMNaGlKLEICDqgnxZojk7k8N6wUjQQ3X9tPjxJ2sOc,110
17
+ pyqrack_cpu-1.34.4.dist-info/top_level.txt,sha256=YE_3q9JTGRLMilNg2tGP1y7uU-Dx8PDao2OhwoIbv8E,8
18
+ pyqrack_cpu-1.34.4.dist-info/RECORD,,