pennylane-qrack 0.21.2__tar.gz → 0.22.1__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.

Potentially problematic release.


This version of pennylane-qrack might be problematic. Click here for more details.

Files changed (34) hide show
  1. {pennylane_qrack-0.21.2 → pennylane_qrack-0.22.1}/Makefile +3 -3
  2. {pennylane_qrack-0.21.2 → pennylane_qrack-0.22.1}/PKG-INFO +3 -2
  3. {pennylane_qrack-0.21.2 → pennylane_qrack-0.22.1}/README.rst +2 -1
  4. pennylane_qrack-0.22.1/pennylane_qrack/QrackStabilizerDeviceConfig.toml +99 -0
  5. {pennylane_qrack-0.21.2 → pennylane_qrack-0.22.1}/pennylane_qrack/_version.py +1 -1
  6. {pennylane_qrack-0.21.2 → pennylane_qrack-0.22.1}/pennylane_qrack/qrack_ace_device.py +1 -1
  7. pennylane_qrack-0.22.1/pennylane_qrack/qrack_stabilizer_device.py +296 -0
  8. {pennylane_qrack-0.21.2 → pennylane_qrack-0.22.1}/pennylane_qrack.egg-info/PKG-INFO +3 -2
  9. {pennylane_qrack-0.21.2 → pennylane_qrack-0.22.1}/pennylane_qrack.egg-info/SOURCES.txt +2 -0
  10. {pennylane_qrack-0.21.2 → pennylane_qrack-0.22.1}/pennylane_qrack.egg-info/entry_points.txt +1 -0
  11. {pennylane_qrack-0.21.2 → pennylane_qrack-0.22.1}/setup.py +1 -1
  12. {pennylane_qrack-0.21.2 → pennylane_qrack-0.22.1}/CHANGELOG.md +0 -0
  13. {pennylane_qrack-0.21.2 → pennylane_qrack-0.22.1}/CMakeLists.txt +0 -0
  14. {pennylane_qrack-0.21.2 → pennylane_qrack-0.22.1}/LICENSE +0 -0
  15. {pennylane_qrack-0.21.2 → pennylane_qrack-0.22.1}/MANIFEST.in +0 -0
  16. {pennylane_qrack-0.21.2 → pennylane_qrack-0.22.1}/catalyst/runtime/include/DataView.hpp +0 -0
  17. {pennylane_qrack-0.21.2 → pennylane_qrack-0.22.1}/catalyst/runtime/include/Exception.hpp +0 -0
  18. {pennylane_qrack-0.21.2 → pennylane_qrack-0.22.1}/catalyst/runtime/include/OQDRuntimeCAPI.h +0 -0
  19. {pennylane_qrack-0.21.2 → pennylane_qrack-0.22.1}/catalyst/runtime/include/QuantumDevice.hpp +0 -0
  20. {pennylane_qrack-0.21.2 → pennylane_qrack-0.22.1}/catalyst/runtime/include/RuntimeCAPI.h +0 -0
  21. {pennylane_qrack-0.21.2 → pennylane_qrack-0.22.1}/catalyst/runtime/include/Types.h +0 -0
  22. {pennylane_qrack-0.21.2 → pennylane_qrack-0.22.1}/pennylane_qrack/QrackAceDeviceConfig.toml +0 -0
  23. {pennylane_qrack-0.21.2 → pennylane_qrack-0.22.1}/pennylane_qrack/QrackDeviceConfig.toml +0 -0
  24. {pennylane_qrack-0.21.2 → pennylane_qrack-0.22.1}/pennylane_qrack/__init__.py +0 -0
  25. {pennylane_qrack-0.21.2 → pennylane_qrack-0.22.1}/pennylane_qrack/qrack_device.cpp +0 -0
  26. {pennylane_qrack-0.21.2 → pennylane_qrack-0.22.1}/pennylane_qrack/qrack_device.py +0 -0
  27. {pennylane_qrack-0.21.2 → pennylane_qrack-0.22.1}/pennylane_qrack.egg-info/dependency_links.txt +0 -0
  28. {pennylane_qrack-0.21.2 → pennylane_qrack-0.22.1}/pennylane_qrack.egg-info/requires.txt +0 -0
  29. {pennylane_qrack-0.21.2 → pennylane_qrack-0.22.1}/pennylane_qrack.egg-info/top_level.txt +0 -0
  30. {pennylane_qrack-0.21.2 → pennylane_qrack-0.22.1}/requirements.txt +0 -0
  31. {pennylane_qrack-0.21.2 → pennylane_qrack-0.22.1}/setup.cfg +0 -0
  32. {pennylane_qrack-0.21.2 → pennylane_qrack-0.22.1}/tests/test_apply.py +0 -0
  33. {pennylane_qrack-0.21.2 → pennylane_qrack-0.22.1}/tests/test_integration.py +0 -0
  34. {pennylane_qrack-0.21.2 → pennylane_qrack-0.22.1}/tests/test_units.py +0 -0
@@ -24,7 +24,7 @@ help:
24
24
  build-deps:
25
25
  ifneq ($(OS),Windows_NT)
26
26
  ifeq ($(QRACK_PRESENT),)
27
- git clone https://github.com/unitaryfund/qrack.git; cd qrack; git checkout 4b2d031d880a9ab3abbcc6dcd7d8a19464e2df89; cd ..
27
+ git clone https://github.com/unitaryfund/qrack.git; cd qrack; git checkout b5a892a9765e03556e8092e615947f75c0ec4663; cd ..
28
28
  endif
29
29
  mkdir -p qrack/build
30
30
  ifeq ($(UNAME_S),Linux)
@@ -36,9 +36,9 @@ endif
36
36
  endif
37
37
  ifeq ($(UNAME_S),Darwin)
38
38
  ifeq ($(UNAME_P),x86_64)
39
- cd qrack/build; cmake -DQBCAPPOW=8 ..; make qrack_pinvoke; cd ../..
39
+ cd qrack/build; cmake -DQBCAPPOW=8 -DBoost_INCLUDE_DIR=/opt/homebrew/include -DBoost_LIBRARY_DIRS=/opt/homebrew/lib ..; make qrack_pinvoke; cd ../..
40
40
  else
41
- cd qrack/build; cmake -DENABLE_RDRAND=OFF -DENABLE_COMPLEX_X2=OFF -DENABLE_SSE3=OFF -DENABLE_OPENCL=OFF -DQBCAPPOW=8 ..; make qrack_pinvoke; cd ../..
41
+ cd qrack/build; cmake -DENABLE_RDRAND=OFF -DENABLE_COMPLEX_X2=OFF -DENABLE_SSE3=OFF -DENABLE_OPENCL=OFF -DQBCAPPOW=8 -DBoost_INCLUDE_DIR=/opt/homebrew/include -DBoost_LIBRARY_DIRS=/opt/homebrew/lib ..; make qrack_pinvoke; cd ../..
42
42
  endif
43
43
  endif
44
44
  endif
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pennylane-qrack
3
- Version: 0.21.2
3
+ Version: 0.22.1
4
4
  Summary: PennyLane plugin for Qrack.
5
5
  Home-page: http://github.com/vm6502q
6
6
  Maintainer: vm6502q
@@ -65,7 +65,8 @@ Features
65
65
 
66
66
  * Provides access to a PyQrack simulator backend via the ``qrack.simulator`` device
67
67
  * Provides access to a (C++) Qrack simulator backend for Catalyst (also) via the ``qrack.simulator`` device
68
- * Provides access to a PyQrack simulator backend optimized for approximate NISQ-scale TFIM via the ``qrack.ace`` device
68
+ * Provides access to a PyQrack Clifford-only simulator backend via the ``qrack.stabilizer`` device
69
+ * Provides access to a PyQrack simulator backend optimized for large-scale approximate simulation via the ``qrack.ace`` device
69
70
 
70
71
  .. installation-start-inclusion-marker-do-not-remove
71
72
 
@@ -22,7 +22,8 @@ Features
22
22
 
23
23
  * Provides access to a PyQrack simulator backend via the ``qrack.simulator`` device
24
24
  * Provides access to a (C++) Qrack simulator backend for Catalyst (also) via the ``qrack.simulator`` device
25
- * Provides access to a PyQrack simulator backend optimized for approximate NISQ-scale TFIM via the ``qrack.ace`` device
25
+ * Provides access to a PyQrack Clifford-only simulator backend via the ``qrack.stabilizer`` device
26
+ * Provides access to a PyQrack simulator backend optimized for large-scale approximate simulation via the ``qrack.ace`` device
26
27
 
27
28
  .. installation-start-inclusion-marker-do-not-remove
28
29
 
@@ -0,0 +1,99 @@
1
+ schema = 3
2
+
3
+ # The set of all gate types supported at the runtime execution interface of the
4
+ # device, i.e., what is supported by the `execute` method. The gate definitions
5
+ # should have the following format:
6
+ #
7
+ # GATE = { properties = [ PROPS ], conditions = [ CONDS ] }
8
+ #
9
+ # where PROPS and CONS are zero or more comma separated quoted strings.
10
+ #
11
+ # PROPS: additional support provided for each gate.
12
+ # - "controllable": if a controlled version of this gate is supported.
13
+ # - "invertible": if the adjoint of this operation is supported.
14
+ # - "differentiable": if device gradient is supported for this gate.
15
+ # CONDS: constraints on the support for each gate.
16
+ # - "analytic" or "finiteshots": if this operation is only supported in
17
+ # either analytic execution or with shots, respectively.
18
+ #
19
+ [operators.gates]
20
+
21
+ PauliX = { properties = [ "controllable", "invertible" ] }
22
+ PauliY = { properties = [ "controllable", "invertible" ] }
23
+ PauliZ = { properties = [ "controllable", "invertible" ] }
24
+ Hadamard = { properties = [ "invertible" ] }
25
+ S = { properties = [ "invertible" ] }
26
+ CNOT = { properties = [ "invertible" ] }
27
+ SWAP = { properties = [ "invertible" ] }
28
+ ISWAP = { properties = [ "invertible" ] }
29
+ PSWAP = { properties = [ "invertible" ] }
30
+ CY = { properties = [ "invertible" ] }
31
+ CZ = { properties = [ "invertible" ] }
32
+ Identity = { properties = [ "controllable", "invertible" ] }
33
+
34
+ # Observables supported by the device for measurements. The observables defined
35
+ # in this section should have the following format:
36
+ #
37
+ # OBSERVABLE = { conditions = [ CONDS ] }
38
+ #
39
+ # where CONDS is zero or more comma separated quoted strings, same as above.
40
+ #
41
+ # CONDS: constraints on the support for each observable.
42
+ # - "analytic" or "finiteshots": if this observable is only supported in
43
+ # either analytic execution or with shots, respectively.
44
+ # - "terms-commute": if a composite operator is only supported under the
45
+ # condition that its terms commute.
46
+ #
47
+ [operators.observables]
48
+
49
+ PauliX = {}
50
+ PauliY = {}
51
+ PauliZ = {}
52
+ Identity = {}
53
+ Prod = {}
54
+ # Hadamard = {}
55
+ # Hermitian = {}
56
+ # Projector = {}
57
+ # SparseHamiltonian = {}
58
+ # Hamiltonian = {}
59
+ # Sum = {}
60
+ # SProd = {}
61
+ # Exp = {}
62
+
63
+ # Types of measurement processes supported on the device. The measurements in
64
+ # this section should have the following format:
65
+ #
66
+ # MEASUREMENT_PROCESS = { conditions = [ CONDS ] }
67
+ #
68
+ # where CONDS is zero or more comma separated quoted strings, same as above.
69
+ #
70
+ # CONDS: constraints on the support for each measurement process.
71
+ # - "analytic" or "finiteshots": if this measurement is only supported
72
+ # in either analytic execution or with shots, respectively.
73
+ #
74
+ [measurement_processes]
75
+
76
+ ExpectationMP = { conditions = [ "analytic" ] }
77
+ VarianceMP = { conditions = [ "analytic" ] }
78
+ ProbabilityMP = { conditions = [ "analytic" ] }
79
+ StateMP = { conditions = [ "analytic" ] }
80
+ SampleMP = { conditions = [ "finiteshots" ] }
81
+ CountsMP = { conditions = [ "finiteshots" ] }
82
+
83
+ # Additional support that the device may provide that informs the compilation
84
+ # process. All accepted fields and their default values are listed below.
85
+ [compilation]
86
+
87
+ # Whether the device is compatible with qjit.
88
+ qjit_compatible = false
89
+
90
+ # Whether the device requires run time generation of the quantum circuit.
91
+ runtime_code_generation = false
92
+
93
+ # Whether the device supports allocating and releasing qubits during execution.
94
+ dynamic_qubit_management = false
95
+
96
+ # The methods of handling mid-circuit measurements that the device supports,
97
+ # e.g., "one-shot", "tree-traversal", "device", etc. An empty list indicates
98
+ # that the device does not support mid-circuit measurements.
99
+ supported_mcm_methods = [ "device", "one-shot" ]
@@ -16,4 +16,4 @@
16
16
  Version number (major.minor.patch[-label])
17
17
  """
18
18
 
19
- __version__ = "0.21.2"
19
+ __version__ = "0.22.1"
@@ -51,7 +51,7 @@ tolerance = 1e-10
51
51
  class QrackAceDevice(QubitDevice):
52
52
  """Qrack Ace device"""
53
53
 
54
- name = "Qrack device"
54
+ name = "Qrack Ace device"
55
55
  short_name = "qrack.ace"
56
56
  pennylane_requires = ">=0.11.0"
57
57
  version = __version__
@@ -0,0 +1,296 @@
1
+ # Copyright 2020 Xanadu Quantum Technologies Inc.
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ """
15
+ Base device class for PennyLane-Qrack.
16
+ """
17
+ from functools import reduce
18
+ import cmath, math
19
+ import os
20
+ import pathlib
21
+ import sys
22
+ import itertools as it
23
+
24
+ import numpy as np
25
+
26
+ # PennyLane v0.42 introduced the `exceptions` module and will raise
27
+ # deprecation warnings if they are imported from the top-level module.
28
+
29
+ # This ensures backwards compatibility with older versions of PennyLane.
30
+ try:
31
+ from pennylane.exceptions import DeviceError, QuantumFunctionError
32
+ except (ModuleNotFoundError, ImportError) as import_error:
33
+ from pennylane import DeviceError, QuantumFunctionError
34
+
35
+ from pennylane.devices import QubitDevice
36
+ from pennylane.ops import (
37
+ BasisState,
38
+ Adjoint,
39
+ )
40
+ from pennylane.wires import Wires
41
+
42
+ from pyqrack import QrackStabilizer, Pauli
43
+
44
+ from ._version import __version__
45
+ from sys import platform as _platform
46
+
47
+ # tolerance for numerical errors
48
+ tolerance = 1e-10
49
+
50
+
51
+ class QrackStabilizerDevice(QubitDevice):
52
+ """Qrack Stabilizer device"""
53
+
54
+ name = "Qrack stabilizer device"
55
+ short_name = "qrack.stabilizer"
56
+ pennylane_requires = ">=0.11.0"
57
+ version = __version__
58
+ author = "Daniel Strano, adapted from Steven Oud and Xanadu"
59
+
60
+ _capabilities = {
61
+ "model": "qubit",
62
+ "tensor_observables": True,
63
+ "inverse_operations": True,
64
+ "returns_state": True,
65
+ }
66
+
67
+ _observable_map = {
68
+ "PauliX": Pauli.PauliX,
69
+ "PauliY": Pauli.PauliY,
70
+ "PauliZ": Pauli.PauliZ,
71
+ "Identity": Pauli.PauliI,
72
+ "Hadamard": None,
73
+ "Hermitian": None,
74
+ "Prod": None,
75
+ # "Sum": None,
76
+ # "SProd": None,
77
+ # "Exp": None,
78
+ # "Projector": None,
79
+ # "Hamiltonian": None,
80
+ # "SparseHamiltonian": None
81
+ }
82
+
83
+ observables = _observable_map.keys()
84
+ operations = {
85
+ "Identity",
86
+ "C(Identity)",
87
+ "SWAP",
88
+ "ISWAP",
89
+ "PSWAP",
90
+ "CNOT",
91
+ "CY",
92
+ "CZ",
93
+ "S",
94
+ "PauliX",
95
+ "C(PauliX)",
96
+ "PauliY",
97
+ "C(PauliY)",
98
+ "PauliZ",
99
+ "C(PauliZ)",
100
+ "Hadamard",
101
+ "SX",
102
+ }
103
+
104
+ config_filepath = pathlib.Path(
105
+ os.path.dirname(sys.modules[__name__].__file__) + "/QrackStabilizerDeviceConfig.toml"
106
+ )
107
+
108
+ def __init__(self, wires=0, shots=None, **kwargs):
109
+ super().__init__(wires=wires, shots=shots)
110
+ self.shots = shots
111
+ self._state = QrackStabilizer(self.num_wires)
112
+ self.device_kwargs = {}
113
+
114
+ def _reverse_state(self):
115
+ end = self.num_wires - 1
116
+ mid = self.num_wires >> 1
117
+ for i in range(mid):
118
+ self._state.swap(i, end - i)
119
+
120
+ def apply(self, operations, **kwargs):
121
+ for op in operations:
122
+ if isinstance(op, BasisState):
123
+ self._apply_basis_state(op)
124
+ else:
125
+ self._apply_gate(op)
126
+
127
+ def _apply_basis_state(self, op):
128
+ """Initialize a basis state"""
129
+ wires = self.map_wires(Wires(op.wires))
130
+ par = op.parameters[0]
131
+ wire_count = len(wires)
132
+ n_basis_state = len(par)
133
+
134
+ if not set(par).issubset({0, 1}):
135
+ raise ValueError("BasisState parameter must consist of 0 or 1 integers.")
136
+ if n_basis_state != wire_count:
137
+ raise ValueError("BasisState parameter and wires must be of equal length.")
138
+
139
+ for i in range(wire_count):
140
+ index = wires.labels[i]
141
+ if par[i] != self._state.m(index):
142
+ self._state.x(index)
143
+
144
+ def _apply_gate(self, op):
145
+ """Apply native qrack gate"""
146
+
147
+ opname = op.name
148
+ if isinstance(op, Adjoint):
149
+ op = op.base
150
+ opname = op.name + ".inv"
151
+
152
+ par = op.parameters
153
+
154
+ # translate op wire labels to consecutive wire labels used by the device
155
+ device_wires = self.map_wires(
156
+ (op.control_wires + op.wires) if op.control_wires else op.wires
157
+ )
158
+
159
+ if opname in [
160
+ "".join(p)
161
+ for p in it.product(
162
+ [
163
+ "CNOT",
164
+ "C(PauliX)",
165
+ ],
166
+ ["", ".inv"],
167
+ )
168
+ ]:
169
+ self._state.mcx(device_wires.labels[:-1], device_wires.labels[-1])
170
+ elif opname in ["C(PauliY)", "C(PauliY).inv"]:
171
+ self._state.mcy(device_wires.labels[:-1], device_wires.labels[-1])
172
+ elif opname in ["C(PauliZ)", "C(PauliZ).inv"]:
173
+ self._state.mcz(device_wires.labels[:-1], device_wires.labels[-1])
174
+ elif opname in ["SWAP", "SWAP.inv"]:
175
+ self._state.swap(device_wires.labels[0], device_wires.labels[1])
176
+ elif opname == "ISWAP":
177
+ self._state.iswap(device_wires.labels[0], device_wires.labels[1])
178
+ elif opname == "ISWAP.inv":
179
+ self._state.adjiswap(device_wires.labels[0], device_wires.labels[1])
180
+ elif opname in ["CY", "CY.inv", "C(CY)", "C(CY).inv"]:
181
+ self._state.mcy(device_wires.labels[:-1], device_wires.labels[-1])
182
+ elif opname in ["CZ", "CZ.inv", "C(CZ)", "C(CZ).inv"]:
183
+ self._state.mcz(device_wires.labels[:-1], device_wires.labels[-1])
184
+ elif opname == "S":
185
+ for label in device_wires.labels:
186
+ self._state.s(label)
187
+ elif opname == "S.inv":
188
+ for label in device_wires.labels:
189
+ self._state.adjs(label)
190
+ elif opname in ["PauliX", "PauliX.inv"]:
191
+ for label in device_wires.labels:
192
+ self._state.x(label)
193
+ elif opname in ["PauliY", "PauliY.inv"]:
194
+ for label in device_wires.labels:
195
+ self._state.y(label)
196
+ elif opname in ["PauliZ", "PauliZ.inv"]:
197
+ for label in device_wires.labels:
198
+ self._state.z(label)
199
+ elif opname in ["Hadamard", "Hadamard.inv"]:
200
+ for label in device_wires.labels:
201
+ self._state.h(label)
202
+ elif opname == "SX":
203
+ half_pi = math.pi / 2
204
+ for label in device_wires.labels:
205
+ self._state.u(label, half_pi, -half_pi, half.pi)
206
+ elif opname == "SX.inv":
207
+ half_pi = math.pi / 2
208
+ for label in device_wires.labels:
209
+ self._state.u(label, -half_pi, -half.pi, half_pi)
210
+ elif opname not in [
211
+ "Identity",
212
+ "Identity.inv",
213
+ "C(Identity)",
214
+ "C(Identity).inv",
215
+ ]:
216
+ raise DeviceError(f"Operation {opname} is not supported on a {self.short_name} device.")
217
+
218
+ def analytic_probability(self, wires=None):
219
+ """Return the (marginal) analytic probability of each computational basis state."""
220
+ if self._state is None:
221
+ return None
222
+
223
+ all_probs = self._abs(self.state) ** 2
224
+ prob = self.marginal_prob(all_probs, wires)
225
+
226
+ if (not "QRACK_FPPOW" in os.environ) or (6 > int(os.environ.get("QRACK_FPPOW"))):
227
+ tot_prob = 0
228
+ for p in prob:
229
+ tot_prob = tot_prob + p
230
+
231
+ if tot_prob != 1.0:
232
+ for i in range(len(prob)):
233
+ prob[i] = prob[i] / tot_prob
234
+
235
+ return prob
236
+
237
+ def expval(self, observable, **kwargs):
238
+ if self.shots is None:
239
+ if isinstance(observable.name, list):
240
+ b = [self._observable_map[obs] for obs in observable.name]
241
+ elif observable.name == "Prod":
242
+ b = [self._observable_map[obs.name] for obs in observable.operands]
243
+ else:
244
+ b = [self._observable_map[observable.name]]
245
+
246
+ if None not in b:
247
+ q = self.map_wires(observable.wires)
248
+ return self._state.pauli_expectation(q, b)
249
+
250
+ # exact expectation value
251
+ if callable(observable.eigvals):
252
+ eigvals = self._asarray(observable.eigvals(), dtype=self.R_DTYPE)
253
+ else: # older version of pennylane
254
+ eigvals = self._asarray(observable.eigvals, dtype=self.R_DTYPE)
255
+ prob = self.probability(wires=observable.wires)
256
+ return self._dot(eigvals, prob)
257
+
258
+ # estimate the ev
259
+ return np.mean(self.sample(observable))
260
+
261
+ def _generate_sample(self):
262
+ rev_sample = self._state.m_all()
263
+ sample = 0
264
+ for i in range(self.num_wires):
265
+ if (rev_sample & (1 << i)) > 0:
266
+ sample |= 1 << (self.num_wires - (i + 1))
267
+ return sample
268
+
269
+ def generate_samples(self):
270
+ if self.shots is None:
271
+ raise QuantumFunctionError(
272
+ "The number of shots has to be explicitly set on the device "
273
+ "when using sample-based measurements."
274
+ )
275
+
276
+ return self._samples
277
+
278
+ if self.shots == 1:
279
+ self._samples = QubitDevice.states_to_binary(
280
+ np.array([self._generate_sample()]), self.num_wires
281
+ )
282
+
283
+ return self._samples
284
+
285
+ # QubitDevice.states_to_binary() doesn't work for >64qb. (Fix by Elara, the custom OpenAI GPT)
286
+ samples = self._state.measure_shots(list(range(self.num_wires - 1, -1, -1)), self.shots)
287
+ self._samples = np.array(
288
+ [list(format(b, f"0{self.num_wires}b")) for b in samples], dtype=np.int8
289
+ )
290
+
291
+ return self._samples
292
+
293
+ def reset(self):
294
+ for i in range(self.num_wires):
295
+ if self._state.m(i):
296
+ self._state.x(i)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pennylane-qrack
3
- Version: 0.21.2
3
+ Version: 0.22.1
4
4
  Summary: PennyLane plugin for Qrack.
5
5
  Home-page: http://github.com/vm6502q
6
6
  Maintainer: vm6502q
@@ -65,7 +65,8 @@ Features
65
65
 
66
66
  * Provides access to a PyQrack simulator backend via the ``qrack.simulator`` device
67
67
  * Provides access to a (C++) Qrack simulator backend for Catalyst (also) via the ``qrack.simulator`` device
68
- * Provides access to a PyQrack simulator backend optimized for approximate NISQ-scale TFIM via the ``qrack.ace`` device
68
+ * Provides access to a PyQrack Clifford-only simulator backend via the ``qrack.stabilizer`` device
69
+ * Provides access to a PyQrack simulator backend optimized for large-scale approximate simulation via the ``qrack.ace`` device
69
70
 
70
71
  .. installation-start-inclusion-marker-do-not-remove
71
72
 
@@ -14,11 +14,13 @@ catalyst/runtime/include/RuntimeCAPI.h
14
14
  catalyst/runtime/include/Types.h
15
15
  pennylane_qrack/QrackAceDeviceConfig.toml
16
16
  pennylane_qrack/QrackDeviceConfig.toml
17
+ pennylane_qrack/QrackStabilizerDeviceConfig.toml
17
18
  pennylane_qrack/__init__.py
18
19
  pennylane_qrack/_version.py
19
20
  pennylane_qrack/qrack_ace_device.py
20
21
  pennylane_qrack/qrack_device.cpp
21
22
  pennylane_qrack/qrack_device.py
23
+ pennylane_qrack/qrack_stabilizer_device.py
22
24
  pennylane_qrack.egg-info/PKG-INFO
23
25
  pennylane_qrack.egg-info/SOURCES.txt
24
26
  pennylane_qrack.egg-info/dependency_links.txt
@@ -1,3 +1,4 @@
1
1
  [pennylane.plugins]
2
2
  qrack.ace = pennylane_qrack.qrack_ace_device:QrackAceDevice
3
3
  qrack.simulator = pennylane_qrack.qrack_device:QrackDevice
4
+ qrack.stabilizer = pennylane_qrack.qrack_stabilizer_device:QrackStabilizerDevice
@@ -44,7 +44,7 @@ info = {
44
44
  "packages": ["pennylane_qrack"],
45
45
  "cmdclass": {"build_py": Build},
46
46
  "entry_points": {
47
- "pennylane.plugins": ["qrack.simulator = pennylane_qrack.qrack_device:QrackDevice", "qrack.ace = pennylane_qrack.qrack_ace_device:QrackAceDevice"]
47
+ "pennylane.plugins": ["qrack.simulator = pennylane_qrack.qrack_device:QrackDevice", "qrack.ace = pennylane_qrack.qrack_ace_device:QrackAceDevice", "qrack.stabilizer = pennylane_qrack.qrack_stabilizer_device:QrackStabilizerDevice"]
48
48
  },
49
49
  "description": "PennyLane plugin for Qrack.",
50
50
  "long_description": open("README.rst").read(),