pyqrack-cuda 1.42.2__tar.gz → 1.43.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.
- {pyqrack_cuda-1.42.2 → pyqrack_cuda-1.43.0}/Makefile +1 -1
- {pyqrack_cuda-1.42.2/pyqrack_cuda.egg-info → pyqrack_cuda-1.43.0}/PKG-INFO +1 -1
- {pyqrack_cuda-1.42.2 → pyqrack_cuda-1.43.0}/pyqrack/__init__.py +1 -0
- {pyqrack_cuda-1.42.2 → pyqrack_cuda-1.43.0}/pyqrack/qrack_neuron_torch_layer.py +0 -1
- {pyqrack_cuda-1.42.2 → pyqrack_cuda-1.43.0}/pyqrack/qrack_simulator.py +26 -2
- pyqrack_cuda-1.43.0/pyqrack/qrack_stabilizer.py +59 -0
- {pyqrack_cuda-1.42.2 → pyqrack_cuda-1.43.0}/pyqrack/qrack_system/qrack_system.py +3 -0
- {pyqrack_cuda-1.42.2 → pyqrack_cuda-1.43.0/pyqrack_cuda.egg-info}/PKG-INFO +1 -1
- {pyqrack_cuda-1.42.2 → pyqrack_cuda-1.43.0}/pyqrack_cuda.egg-info/SOURCES.txt +1 -0
- {pyqrack_cuda-1.42.2 → pyqrack_cuda-1.43.0}/setup.py +1 -1
- {pyqrack_cuda-1.42.2 → pyqrack_cuda-1.43.0}/LICENSE +0 -0
- {pyqrack_cuda-1.42.2 → pyqrack_cuda-1.43.0}/MANIFEST.in +0 -0
- {pyqrack_cuda-1.42.2 → pyqrack_cuda-1.43.0}/README.md +0 -0
- {pyqrack_cuda-1.42.2 → pyqrack_cuda-1.43.0}/pyproject.toml +0 -0
- {pyqrack_cuda-1.42.2 → pyqrack_cuda-1.43.0}/pyqrack/neuron_activation_fn.py +0 -0
- {pyqrack_cuda-1.42.2 → pyqrack_cuda-1.43.0}/pyqrack/pauli.py +0 -0
- {pyqrack_cuda-1.42.2 → pyqrack_cuda-1.43.0}/pyqrack/qrack_circuit.py +0 -0
- {pyqrack_cuda-1.42.2 → pyqrack_cuda-1.43.0}/pyqrack/qrack_neuron.py +0 -0
- {pyqrack_cuda-1.42.2 → pyqrack_cuda-1.43.0}/pyqrack/qrack_system/__init__.py +0 -0
- {pyqrack_cuda-1.42.2 → pyqrack_cuda-1.43.0}/pyqrack/quimb_circuit_type.py +0 -0
- {pyqrack_cuda-1.42.2 → pyqrack_cuda-1.43.0}/pyqrack/stats/__init__.py +0 -0
- {pyqrack_cuda-1.42.2 → pyqrack_cuda-1.43.0}/pyqrack/stats/load_quantized_data.py +0 -0
- {pyqrack_cuda-1.42.2 → pyqrack_cuda-1.43.0}/pyqrack/stats/quantize_by_range.py +0 -0
- {pyqrack_cuda-1.42.2 → pyqrack_cuda-1.43.0}/pyqrack_cuda.egg-info/dependency_links.txt +0 -0
- {pyqrack_cuda-1.42.2 → pyqrack_cuda-1.43.0}/pyqrack_cuda.egg-info/not-zip-safe +0 -0
- {pyqrack_cuda-1.42.2 → pyqrack_cuda-1.43.0}/pyqrack_cuda.egg-info/requires.txt +0 -0
- {pyqrack_cuda-1.42.2 → pyqrack_cuda-1.43.0}/pyqrack_cuda.egg-info/top_level.txt +0 -0
- {pyqrack_cuda-1.42.2 → pyqrack_cuda-1.43.0}/setup.cfg +0 -0
@@ -18,7 +18,7 @@ help:
|
|
18
18
|
build-deps:
|
19
19
|
ifneq ($(OS),Windows_NT)
|
20
20
|
ifeq ($(QRACK_PRESENT),)
|
21
|
-
git clone https://github.com/unitaryfund/qrack.git; cd qrack; git checkout
|
21
|
+
git clone https://github.com/unitaryfund/qrack.git; cd qrack; git checkout 1efe4ad357b4bfa3864823f2228e713cfeedee94; cd ..
|
22
22
|
endif
|
23
23
|
mkdir -p qrack/build
|
24
24
|
ifeq ($(UNAME_S),Linux)
|
@@ -10,5 +10,6 @@ from .qrack_circuit import QrackCircuit
|
|
10
10
|
from .qrack_neuron import QrackNeuron
|
11
11
|
from .qrack_neuron_torch_layer import QrackTorchNeuron, QrackNeuronFunction, QrackNeuronTorchLayer
|
12
12
|
from .qrack_simulator import QrackSimulator
|
13
|
+
from .qrack_stabilizer import QrackStabilizer
|
13
14
|
from .qrack_system import QrackSystem, Qrack
|
14
15
|
from .stats.quantize_by_range import quantize_by_range
|
@@ -32,10 +32,9 @@ except:
|
|
32
32
|
|
33
33
|
|
34
34
|
class QrackSimulator:
|
35
|
-
"""Interface for all the
|
35
|
+
"""Interface for all the Qrack functionality.
|
36
36
|
|
37
37
|
Attributes:
|
38
|
-
qubitCount(int): Number of qubits that are to be simulated.
|
39
38
|
sid(int): Corresponding simulator id.
|
40
39
|
"""
|
41
40
|
|
@@ -78,6 +77,7 @@ class QrackSimulator:
|
|
78
77
|
)
|
79
78
|
|
80
79
|
self.is_tensor_network = isTensorNetwork
|
80
|
+
self.is_pure_stabilizer = False
|
81
81
|
|
82
82
|
if cloneSid > -1:
|
83
83
|
self.sid = Qrack.qrack_lib.init_clone(cloneSid)
|
@@ -1250,6 +1250,8 @@ class QrackSimulator:
|
|
1250
1250
|
"""
|
1251
1251
|
if self.is_tensor_network:
|
1252
1252
|
raise RuntimeError("QrackSimulator with isTensorNetwork=True option cannot mul()! (Turn off just this option, in the constructor.)")
|
1253
|
+
if self.is_pure_stabilizer:
|
1254
|
+
raise RuntimeError("QrackStabilizer cannot mul()! (Create a QrackSimulator instead, also with isTensorNetwork=False.)")
|
1253
1255
|
|
1254
1256
|
if len(q) != len(o):
|
1255
1257
|
raise RuntimeError("Lengths of list parameters are mismatched.")
|
@@ -1283,6 +1285,8 @@ class QrackSimulator:
|
|
1283
1285
|
"""
|
1284
1286
|
if self.is_tensor_network:
|
1285
1287
|
raise RuntimeError("QrackSimulator with isTensorNetwork=True option cannot div()! (Turn off just this option, in the constructor.)")
|
1288
|
+
if self.is_pure_stabilizer:
|
1289
|
+
raise RuntimeError("QrackStabilizer cannot div()! (Create a QrackSimulator instead, also with isTensorNetwork=False.)")
|
1286
1290
|
|
1287
1291
|
if len(q) != len(o):
|
1288
1292
|
raise RuntimeError("Lengths of list parameters are mismatched.")
|
@@ -1374,6 +1378,8 @@ class QrackSimulator:
|
|
1374
1378
|
"""
|
1375
1379
|
if self.is_tensor_network:
|
1376
1380
|
raise RuntimeError("QrackSimulator with isTensorNetwork=True option cannot pown()! (Turn off just this option, in the constructor.)")
|
1381
|
+
if self.is_pure_stabilizer:
|
1382
|
+
raise RuntimeError("QrackStabilizer cannot pown()! (Create a QrackSimulator instead, also with isTensorNetwork=False.)")
|
1377
1383
|
|
1378
1384
|
if len(q) != len(o):
|
1379
1385
|
raise RuntimeError("Lengths of list parameters are mismatched.")
|
@@ -1461,6 +1467,8 @@ class QrackSimulator:
|
|
1461
1467
|
"""
|
1462
1468
|
if self.is_tensor_network:
|
1463
1469
|
raise RuntimeError("QrackSimulator with isTensorNetwork=True option cannot mcmul()! (Turn off just this option, in the constructor.)")
|
1470
|
+
if self.is_pure_stabilizer:
|
1471
|
+
raise RuntimeError("QrackStabilizer cannot mcmul()! (Create a QrackSimulator instead, also with isTensorNetwork=False.)")
|
1464
1472
|
|
1465
1473
|
if len(q) != len(o):
|
1466
1474
|
raise RuntimeError("Lengths of list parameters are mismatched.")
|
@@ -1497,6 +1505,8 @@ class QrackSimulator:
|
|
1497
1505
|
"""
|
1498
1506
|
if self.is_tensor_network:
|
1499
1507
|
raise RuntimeError("QrackSimulator with isTensorNetwork=True option cannot mcdiv()! (Turn off just this option, in the constructor.)")
|
1508
|
+
if self.is_pure_stabilizer:
|
1509
|
+
raise RuntimeError("QrackStabilizer cannot mcdiv()! (Create a QrackSimulator instead, also with isTensorNetwork=False.)")
|
1500
1510
|
|
1501
1511
|
if len(q) != len(o):
|
1502
1512
|
raise RuntimeError("Lengths of list parameters are mismatched.")
|
@@ -1599,6 +1609,8 @@ class QrackSimulator:
|
|
1599
1609
|
"""
|
1600
1610
|
if self.is_tensor_network:
|
1601
1611
|
raise RuntimeError("QrackSimulator with isTensorNetwork=True option cannot mcpown()! (Turn off just this option, in the constructor.)")
|
1612
|
+
if self.is_pure_stabilizer:
|
1613
|
+
raise RuntimeError("QrackStabilizer cannot mcpown()! (Create a QrackSimulator instead, also with isTensorNetwork=False.)")
|
1602
1614
|
|
1603
1615
|
if len(q) != len(o):
|
1604
1616
|
raise RuntimeError("Lengths of list parameters are mismatched.")
|
@@ -1634,6 +1646,8 @@ class QrackSimulator:
|
|
1634
1646
|
"""
|
1635
1647
|
if self.is_tensor_network:
|
1636
1648
|
raise RuntimeError("QrackSimulator with isTensorNetwork=True option cannot lda()! (Turn off just this option, in the constructor.)")
|
1649
|
+
if self.is_pure_stabilizer:
|
1650
|
+
raise RuntimeError("QrackStabilizer cannot lda()! (Create a QrackSimulator instead, also with isTensorNetwork=False.)")
|
1637
1651
|
|
1638
1652
|
Qrack.qrack_lib.LDA(
|
1639
1653
|
self.sid,
|
@@ -1662,6 +1676,8 @@ class QrackSimulator:
|
|
1662
1676
|
"""
|
1663
1677
|
if self.is_tensor_network:
|
1664
1678
|
raise RuntimeError("QrackSimulator with isTensorNetwork=True option cannot adc()! (Turn off just this option, in the constructor.)")
|
1679
|
+
if self.is_pure_stabilizer:
|
1680
|
+
raise RuntimeError("QrackStabilizer cannot adc()! (Create a QrackSimulator instead, also with isTensorNetwork=False.)")
|
1665
1681
|
|
1666
1682
|
Qrack.qrack_lib.ADC(
|
1667
1683
|
self.sid,
|
@@ -1691,6 +1707,8 @@ class QrackSimulator:
|
|
1691
1707
|
"""
|
1692
1708
|
if self.is_tensor_network:
|
1693
1709
|
raise RuntimeError("QrackSimulator with isTensorNetwork=True option cannot sbc()! (Turn off just this option, in the constructor.)")
|
1710
|
+
if self.is_pure_stabilizer:
|
1711
|
+
raise RuntimeError("QrackStabilizer cannot sbc()! (Create a QrackSimulator instead, also with isTensorNetwork=False.)")
|
1694
1712
|
|
1695
1713
|
Qrack.qrack_lib.SBC(
|
1696
1714
|
self.sid,
|
@@ -1721,6 +1739,8 @@ class QrackSimulator:
|
|
1721
1739
|
"""
|
1722
1740
|
if self.is_tensor_network:
|
1723
1741
|
raise RuntimeError("QrackSimulator with isTensorNetwork=True option cannot hash()! (Turn off just this option, in the constructor.)")
|
1742
|
+
if self.is_pure_stabilizer:
|
1743
|
+
raise RuntimeError("QrackStabilizer cannot hash()! (Create a QrackSimulator instead, also with isTensorNetwork=False.)")
|
1724
1744
|
|
1725
1745
|
Qrack.qrack_lib.Hash(
|
1726
1746
|
self.sid, len(q), self._ulonglong_byref(q), self._to_ubyte(len(q), t)
|
@@ -2887,6 +2907,8 @@ class QrackSimulator:
|
|
2887
2907
|
"""
|
2888
2908
|
if self.is_tensor_network:
|
2889
2909
|
raise RuntimeError("QrackSimulator with isTensorNetwork=True option cannot phase_parity()! (Turn off just this option, in the constructor.)")
|
2910
|
+
if self.is_pure_stabilizer:
|
2911
|
+
raise RuntimeError("QrackStabilizer cannot phase_parity()! (Create a QrackSimulator instead, also with isTensorNetwork=False.)")
|
2890
2912
|
|
2891
2913
|
Qrack.qrack_lib.PhaseParity(
|
2892
2914
|
self.sid, ctypes.c_double(la), len(q), self._ulonglong_byref(q)
|
@@ -2908,6 +2930,8 @@ class QrackSimulator:
|
|
2908
2930
|
"""
|
2909
2931
|
if self.is_tensor_network:
|
2910
2932
|
raise RuntimeError("QrackSimulator with isTensorNetwork=True option cannot phase_root_n()! (Turn off just this option, in the constructor.)")
|
2933
|
+
if self.is_pure_stabilizer:
|
2934
|
+
raise RuntimeError("QrackStabilizer cannot phase_root_n()! (Create a QrackSimulator instead, also with isTensorNetwork=False.)")
|
2911
2935
|
|
2912
2936
|
Qrack.qrack_lib.PhaseRootN(
|
2913
2937
|
self.sid, n, len(q), self._ulonglong_byref(q)
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# (C) Daniel Strano and the Qrack contributors 2017-2025. All rights reserved.
|
2
|
+
#
|
3
|
+
# Use of this source code is governed by an MIT-style license that can be
|
4
|
+
# found in the LICENSE file or at https://opensource.org/licenses/MIT.
|
5
|
+
from .qrack_simulator import QrackSimulator
|
6
|
+
from .qrack_system import Qrack
|
7
|
+
|
8
|
+
|
9
|
+
class QrackStabilizer(QrackSimulator):
|
10
|
+
"""Interface for pure-stabilizer Qrack functionality.
|
11
|
+
|
12
|
+
Like QrackSimulator with isTensorNetwork=True, QrackStabilizer does not implement a general ALU or phase parity operations.
|
13
|
+
Unlike isTensorNetwork=True, QrackStabilizer does implement compose(), decompose(), and dispose()
|
14
|
+
Even if your operation is non-Clifford in full generality, QrackStabilizer will attempt to reduce it to a Clifford case.
|
15
|
+
Hence, QrackStabilizer inherits the full interface of QrackSimulator (via Qrack::QInterface).
|
16
|
+
|
17
|
+
Attributes:
|
18
|
+
sid(int): Corresponding simulator id.
|
19
|
+
"""
|
20
|
+
|
21
|
+
def __init__(
|
22
|
+
self,
|
23
|
+
qubitCount=-1,
|
24
|
+
cloneSid=-1,
|
25
|
+
pyzxCircuit=None,
|
26
|
+
qiskitCircuit=None,
|
27
|
+
):
|
28
|
+
self.sid = None
|
29
|
+
|
30
|
+
if pyzxCircuit is not None:
|
31
|
+
qubitCount = pyzxCircuit.qubits
|
32
|
+
elif qiskitCircuit is not None and qubitCount < 0:
|
33
|
+
raise RuntimeError(
|
34
|
+
"Must specify qubitCount with qiskitCircuit parameter in QrackSimulator constructor!"
|
35
|
+
)
|
36
|
+
|
37
|
+
if qubitCount > -1 and cloneSid > -1:
|
38
|
+
raise RuntimeError(
|
39
|
+
"Cannot clone a QrackStabilizer and specify its qubit length at the same time, in QrackStabilizer constructor!"
|
40
|
+
)
|
41
|
+
|
42
|
+
self.is_tensor_network = False
|
43
|
+
self.is_pure_stabilizer = True
|
44
|
+
|
45
|
+
if cloneSid > -1:
|
46
|
+
self.sid = Qrack.qrack_lib.init_clone(cloneSid)
|
47
|
+
else:
|
48
|
+
if qubitCount < 0:
|
49
|
+
qubitCount = 0
|
50
|
+
|
51
|
+
self.sid = Qrack.qrack_lib.init_count_stabilizer(qubitCount)
|
52
|
+
|
53
|
+
self._throw_if_error()
|
54
|
+
|
55
|
+
if pyzxCircuit is not None:
|
56
|
+
self.run_pyzx_gates(pyzxCircuit.gates)
|
57
|
+
elif qiskitCircuit is not None:
|
58
|
+
self.run_qiskit_circuit(qiskitCircuit)
|
59
|
+
|
@@ -120,6 +120,9 @@ class QrackSystem:
|
|
120
120
|
c_bool
|
121
121
|
]
|
122
122
|
|
123
|
+
self.qrack_lib.init_count_stabilizer.restype = c_ulonglong
|
124
|
+
self.qrack_lib.init_count_stabilizer.argtypes = [c_ulonglong]
|
125
|
+
|
123
126
|
self.qrack_lib.init_clone.restype = c_ulonglong
|
124
127
|
self.qrack_lib.init_clone.argtypes = [c_ulonglong]
|
125
128
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|