pennylane-qrack 0.24.1__py3-none-win_amd64.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.
@@ -0,0 +1,313 @@
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
+ # This will trigger Gaussian elimination,
248
+ # so it only happens once.
249
+ self._state.try_separate_1qb(0)
250
+ # It's cheap to clone a stabilizer,
251
+ # but we don't want to have to transform
252
+ # back after terminal measurement.
253
+ state_clone = self._state.clone()
254
+
255
+ q = self.map_wires(observable.wires)
256
+ for qb, base in zip(q, b):
257
+ match base:
258
+ case Pauli.PauliX:
259
+ state_clone.h(qb)
260
+ case Pauli.PauliY:
261
+ state_clone.adjs(qb)
262
+ state_clone.h(qb)
263
+ b = [Pauli.PauliZ] * len(b)
264
+
265
+ return self._state.pauli_expectation(q, b)
266
+
267
+ # exact expectation value
268
+ if callable(observable.eigvals):
269
+ eigvals = self._asarray(observable.eigvals(), dtype=self.R_DTYPE)
270
+ else: # older version of pennylane
271
+ eigvals = self._asarray(observable.eigvals, dtype=self.R_DTYPE)
272
+ prob = self.probability(wires=observable.wires)
273
+ return self._dot(eigvals, prob)
274
+
275
+ # estimate the ev
276
+ return np.mean(self.sample(observable))
277
+
278
+ def _generate_sample(self):
279
+ rev_sample = self._state.m_all()
280
+ sample = 0
281
+ for i in range(self.num_wires):
282
+ if (rev_sample & (1 << i)) > 0:
283
+ sample |= 1 << (self.num_wires - (i + 1))
284
+ return sample
285
+
286
+ def generate_samples(self):
287
+ if self.shots is None:
288
+ raise QuantumFunctionError(
289
+ "The number of shots has to be explicitly set on the device "
290
+ "when using sample-based measurements."
291
+ )
292
+
293
+ return self._samples
294
+
295
+ if self.shots == 1:
296
+ self._samples = QubitDevice.states_to_binary(
297
+ np.array([self._generate_sample()]), self.num_wires
298
+ )
299
+
300
+ return self._samples
301
+
302
+ # QubitDevice.states_to_binary() doesn't work for >64qb. (Fix by Elara, the custom OpenAI GPT)
303
+ samples = self._state.measure_shots(list(range(self.num_wires - 1, -1, -1)), self.shots)
304
+ self._samples = np.array(
305
+ [list(format(b, f"0{self.num_wires}b")) for b in samples], dtype=np.int8
306
+ )
307
+
308
+ return self._samples
309
+
310
+ def reset(self):
311
+ for i in range(self.num_wires):
312
+ if self._state.m(i):
313
+ self._state.x(i)
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,146 @@
1
+ Metadata-Version: 2.1
2
+ Name: pennylane-qrack
3
+ Version: 0.24.1
4
+ Summary: PennyLane plugin for Qrack.
5
+ Home-page: http://github.com/vm6502q
6
+ Maintainer: vm6502q
7
+ Maintainer-email: stranoj@gmail.com
8
+ License: Apache License 2.0
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Environment :: Console
11
+ Classifier: Intended Audience :: Science/Research
12
+ Classifier: License :: OSI Approved :: Apache Software License
13
+ Classifier: Natural Language :: English
14
+ Classifier: Operating System :: POSIX
15
+ Classifier: Operating System :: MacOS :: MacOS X
16
+ Classifier: Operating System :: POSIX :: Linux
17
+ Classifier: Operating System :: Microsoft :: Windows
18
+ Classifier: Programming Language :: Python
19
+ Classifier: Programming Language :: Python :: 3
20
+ Classifier: Programming Language :: Python :: 3.9
21
+ Classifier: Programming Language :: Python :: 3.10
22
+ Classifier: Programming Language :: Python :: 3.11
23
+ Classifier: Programming Language :: Python :: 3.12
24
+ Classifier: Programming Language :: Python :: 3 :: Only
25
+ Classifier: Topic :: Scientific/Engineering :: Physics
26
+ Provides: pennylane_qrack
27
+ Description-Content-Type: text/x-rst
28
+ License-File: LICENSE
29
+ Requires-Dist: pennylane>=0.39.0
30
+ Requires-Dist: pyqrack>=1.30.0
31
+ Requires-Dist: numpy>=1.16
32
+
33
+ PennyLane-Qrack Plugin
34
+ #######################
35
+
36
+ .. header-start-inclusion-marker-do-not-remove
37
+
38
+ The PennyLane-Qrack plugin integrates the Qrack quantum computing framework with PennyLane's quantum machine learning capabilities.
39
+
40
+ 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>`__
41
+
42
+ This plugin is addapted from the `PennyLane-Qulacs plugin, <https://github.com/PennyLaneAI/pennylane-qulacs>`__ under the Apache License 2.0, with many thanks to the original developers!
43
+
44
+ `PennyLane <https://pennylane.readthedocs.io>`__ is a cross-platform Python library for quantum machine learning, automatic differentiation, and optimization of hybrid quantum-classical computations.
45
+
46
+ `unitaryfund/qrack <https://github.com/unitaryfund/qrack>`__ (formerly **vm6502q/qrack**) is a software library for quantum computing, written in C++ and with GPU support.
47
+
48
+ `PennyLane Catalyst <https://docs.pennylane.ai/projects/catalyst/en/stable/index.html>`__ provides optional quantum just-in-time (QJIT) compilation, for improved performance.
49
+
50
+ .. header-end-inclusion-marker-do-not-remove
51
+
52
+ Features
53
+ ========
54
+
55
+ * Provides access to a PyQrack simulator backend via the ``qrack.simulator`` device
56
+ * Provides access to a (C++) Qrack simulator backend for Catalyst (also) via the ``qrack.simulator`` device
57
+ * Provides access to a PyQrack Clifford-only simulator backend via the ``qrack.stabilizer`` device
58
+ * Provides access to a PyQrack simulator backend optimized for large-scale approximate simulation via the ``qrack.ace`` device
59
+
60
+ .. installation-start-inclusion-marker-do-not-remove
61
+
62
+ Installation
63
+ ============
64
+
65
+ This plugin requires Python version 3.9 or above, as well as PennyLane and the Qrack library.
66
+
67
+ Installation of this plugin as well as all its Python dependencies can be done using ``pip`` (or ``pip3``, as appropriate):
68
+
69
+ .. code-block:: bash
70
+
71
+ $ pip3 install pennylane-qrack
72
+
73
+ This step should automatically build the latest ``main`` branch Qrack library, for Catalyst support, if Catalyst support is available.
74
+
75
+ Dependencies
76
+ ~~~~~~~~~~~~
77
+
78
+ PennyLane-Qrack requires the following libraries be installed:
79
+
80
+ * `Python <http://python.org/>`__ >= 3.9
81
+ * `Qrack <https://github.com/unitaryfund/qrack>`__ >= 9.0
82
+
83
+ as well as the following Python packages:
84
+
85
+ * `PennyLane <http://pennylane.readthedocs.io/>`__ >= 0.32
86
+ * `PyQrack <https://github.com/vm6502q/pyqrack>`__ >= 1.28.0
87
+
88
+ with optional functionality provided by the following Python packages:
89
+
90
+ * `Catalyst <https://docs.pennylane.ai/projects/catalyst/en/stable/index.html>`__ >= 0.7
91
+
92
+
93
+ If you currently do not have Python 3 installed, we recommend
94
+ `Anaconda for Python 3 <https://www.anaconda.com/download/>`__, a distributed version of Python packaged
95
+ for scientific computation.
96
+
97
+ .. installation-end-inclusion-marker-do-not-remove
98
+
99
+ Tests
100
+ ~~~~~
101
+
102
+ To test that the PennyLane-Qrack plugin is working correctly you can run
103
+
104
+ .. code-block:: bash
105
+
106
+ $ make test
107
+
108
+ in the source folder.
109
+
110
+ Contributing
111
+ ============
112
+
113
+ We welcome contributions - simply fork the repository of this plugin, and then make a
114
+ `pull request <https://help.github.com/articles/about-pull-requests/>`__ containing your contribution.
115
+ All contributers to this plugin will be listed as authors on the releases.
116
+
117
+ We also encourage bug reports, suggestions for new features and enhancements, and even links to cool projects
118
+ or applications built on PennyLane.
119
+
120
+ Authors
121
+ =======
122
+
123
+ PennyLane-Qrack has been directly adapted by Daniel Strano from PennyLane-Qulacs. PennyLane-Qulacs is the work of `many contributors <https://github.com/PennyLaneAI/pennylane-qulacs/graphs/contributors>`__.
124
+
125
+ If you are doing research using PennyLane and PennyLane-Qulacs, please cite `their paper <https://arxiv.org/abs/1811.04968>`__:
126
+
127
+ Ville Bergholm, Josh Izaac, Maria Schuld, Christian Gogolin, M. Sohaib Alam, Shahnawaz Ahmed,
128
+ Juan Miguel Arrazola, Carsten Blank, Alain Delgado, Soran Jahangiri, Keri McKiernan, Johannes Jakob Meyer,
129
+ Zeyue Niu, Antal Száva, and Nathan Killoran.
130
+ *PennyLane: Automatic differentiation of hybrid quantum-classical computations.* 2018. arXiv:1811.04968
131
+
132
+ Support
133
+ =======
134
+
135
+ - **Source Code:** https://github.com/vm6502q/pennylane-qrack
136
+ - **Issue Tracker:** https://github.com/vm6502q/pennylane-qrack/issues
137
+ - **PennyLane Forum:** https://discuss.pennylane.ai
138
+
139
+ If you are having issues, please let us know by posting the issue on our Github issue tracker, or
140
+ by asking a question in the forum.
141
+
142
+ License
143
+ =======
144
+
145
+ The PennyLane-Qrack plugin is **free** and **open source**, released under
146
+ the `Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0>`__.
@@ -0,0 +1,15 @@
1
+ pennylane_qrack/QrackAceDeviceConfig.toml,sha256=zrGB9gVmB105WX4s7MS-MceoXC5sNTRysxNa_StBpl0,4625
2
+ pennylane_qrack/QrackDeviceConfig.toml,sha256=M3rIJH9GlMJv6lapfSXses5qauSvezs8OqnHYLq6in0,5576
3
+ pennylane_qrack/QrackStabilizerDeviceConfig.toml,sha256=njxwgqpEEYHvuYINdaBuwXM8i44Nl5TsdIC5zZw-Rag,4064
4
+ pennylane_qrack/__init__.py,sha256=5iuZ5OqhRPLxj5cs9jGaUTDv55iPXRVbcDHM6FNk-5c,689
5
+ pennylane_qrack/_version.py,sha256=s7dfClbH81-M3_fPnp1tHl7McNM2XlTrny1r2v0cmdA,708
6
+ pennylane_qrack/qrack_ace_device.py,sha256=HvZ3Hbb4pTo7rLfHwyRNTO7TPxJVdBdHf47COpuURok,17540
7
+ pennylane_qrack/qrack_device.cpp,sha256=Ch128W5_yoAPNRxgrq2qNF2KCpFbkwm6CKJpJKJTbgs,38176
8
+ pennylane_qrack/qrack_device.py,sha256=MxApoek3e8cH86MioENwvpx6x_poeO6bXHOWG0g7emk,29359
9
+ pennylane_qrack/qrack_stabilizer_device.py,sha256=2VUfJB2W7UzFXKCatdkYZkjlILsuxmWGyUHIezrhFdA,10978
10
+ pennylane_qrack-0.24.1.dist-info/LICENSE,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
11
+ pennylane_qrack-0.24.1.dist-info/METADATA,sha256=x329etiCWHucYJwK_G9vLjOR0srFBpnR9EEaX9ovCpE,6092
12
+ pennylane_qrack-0.24.1.dist-info/WHEEL,sha256=JMWfR_Dj7ISokcwe0cBhCfK6JKnIi-ZX11L6d_ntt6o,98
13
+ pennylane_qrack-0.24.1.dist-info/entry_points.txt,sha256=5eoa4LFV7DuSLFbs6tzFvuVIHr6zOovxqlDsn2cinP4,220
14
+ pennylane_qrack-0.24.1.dist-info/top_level.txt,sha256=5NFMNHqCHtVLwNkLg66xz846uUJAlnOJ5VGa6ulW1ow,16
15
+ pennylane_qrack-0.24.1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: bdist_wheel (0.45.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-win_amd64
5
+