pennylane-qrack 0.10.1__py3-none-macosx_12_0_x86_64.whl → 0.10.4__py3-none-macosx_12_0_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 pennylane-qrack might be problematic. Click here for more details.
- pennylane_qrack/CMakeCache.txt +1 -1
- pennylane_qrack/_version.py +1 -1
- pennylane_qrack/libqrack_device.dylib +0 -0
- pennylane_qrack/qrack_device.py +53 -25
- {pennylane_qrack-0.10.1.dist-info → pennylane_qrack-0.10.4.dist-info}/METADATA +1 -1
- pennylane_qrack-0.10.4.dist-info/RECORD +15 -0
- {pennylane_qrack-0.10.1.dist-info → pennylane_qrack-0.10.4.dist-info}/WHEEL +1 -1
- pennylane_qrack-0.10.1.dist-info/RECORD +0 -15
- {pennylane_qrack-0.10.1.dist-info → pennylane_qrack-0.10.4.dist-info}/LICENSE +0 -0
- {pennylane_qrack-0.10.1.dist-info → pennylane_qrack-0.10.4.dist-info}/entry_points.txt +0 -0
- {pennylane_qrack-0.10.1.dist-info → pennylane_qrack-0.10.4.dist-info}/top_level.txt +0 -0
pennylane_qrack/CMakeCache.txt
CHANGED
|
@@ -97,7 +97,7 @@ CMAKE_INSTALL_PREFIX:PATH=/usr/local
|
|
|
97
97
|
CMAKE_LINKER:FILEPATH=/Applications/Xcode_14.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
|
|
98
98
|
|
|
99
99
|
//Path to a program.
|
|
100
|
-
CMAKE_MAKE_PROGRAM:FILEPATH=/usr/bin/
|
|
100
|
+
CMAKE_MAKE_PROGRAM:FILEPATH=/usr/local/bin/gmake
|
|
101
101
|
|
|
102
102
|
//Flags used by the linker during the creation of modules during
|
|
103
103
|
// all build types.
|
pennylane_qrack/_version.py
CHANGED
|
Binary file
|
pennylane_qrack/qrack_device.py
CHANGED
|
@@ -24,7 +24,8 @@ import itertools as it
|
|
|
24
24
|
|
|
25
25
|
import numpy as np
|
|
26
26
|
|
|
27
|
-
from pennylane import
|
|
27
|
+
from pennylane import DeviceError, QuantumFunctionError
|
|
28
|
+
from pennylane.devices import QubitDevice
|
|
28
29
|
from pennylane.ops import (
|
|
29
30
|
QubitStateVector,
|
|
30
31
|
BasisState,
|
|
@@ -175,31 +176,35 @@ class QrackDevice(QubitDevice):
|
|
|
175
176
|
|
|
176
177
|
def __init__(self, wires=0, shots=None, **kwargs):
|
|
177
178
|
options = dict(kwargs)
|
|
178
|
-
if
|
|
179
|
-
self.isStabilizerHybrid = options[
|
|
180
|
-
if
|
|
181
|
-
self.isTensorNetwork = options[
|
|
182
|
-
if
|
|
183
|
-
self.isSchmidtDecompose = options[
|
|
184
|
-
if
|
|
185
|
-
self.isBinaryDecisionTree = options[
|
|
186
|
-
if
|
|
187
|
-
self.isOpenCL = options[
|
|
188
|
-
if
|
|
189
|
-
self.isHostPointer = options[
|
|
190
|
-
if
|
|
191
|
-
self.noise = options[
|
|
179
|
+
if "isStabilizerHybrid" in options:
|
|
180
|
+
self.isStabilizerHybrid = options["isStabilizerHybrid"]
|
|
181
|
+
if "isTensorNetwork" in options:
|
|
182
|
+
self.isTensorNetwork = options["isTensorNetwork"]
|
|
183
|
+
if "isSchmidtDecompose" in options:
|
|
184
|
+
self.isSchmidtDecompose = options["isSchmidtDecompose"]
|
|
185
|
+
if "isBinaryDecisionTree" in options:
|
|
186
|
+
self.isBinaryDecisionTree = options["isBinaryDecisionTree"]
|
|
187
|
+
if "isOpenCL" in options:
|
|
188
|
+
self.isOpenCL = options["isOpenCL"]
|
|
189
|
+
if "isHostPointer" in options:
|
|
190
|
+
self.isHostPointer = options["isHostPointer"]
|
|
191
|
+
if "noise" in options:
|
|
192
|
+
self.noise = options["noise"]
|
|
193
|
+
if (self.noise != 0) and (shots is None):
|
|
194
|
+
raise ValueError("Shots must be finite for noisy simulation (not analytical mode).")
|
|
192
195
|
super().__init__(wires=wires, shots=shots)
|
|
196
|
+
self.shots = shots
|
|
193
197
|
self._state = QrackSimulator(
|
|
194
198
|
self.num_wires,
|
|
195
|
-
isStabilizerHybrid
|
|
199
|
+
isStabilizerHybrid=self.isStabilizerHybrid,
|
|
196
200
|
isTensorNetwork=self.isTensorNetwork,
|
|
197
201
|
isSchmidtDecompose=self.isSchmidtDecompose,
|
|
198
202
|
isBinaryDecisionTree=self.isBinaryDecisionTree,
|
|
199
203
|
isOpenCL=self.isOpenCL,
|
|
200
204
|
isHostPointer=self.isHostPointer,
|
|
201
|
-
noise
|
|
205
|
+
noise=self.noise,
|
|
202
206
|
)
|
|
207
|
+
self._circuit = []
|
|
203
208
|
|
|
204
209
|
def _reverse_state(self):
|
|
205
210
|
end = self.num_wires - 1
|
|
@@ -216,7 +221,14 @@ class QrackDevice(QubitDevice):
|
|
|
216
221
|
operations (List[pennylane.Operation]): operations to be applied
|
|
217
222
|
"""
|
|
218
223
|
|
|
219
|
-
|
|
224
|
+
self._circuit = self._circuit + operations
|
|
225
|
+
if self.noise == 0:
|
|
226
|
+
self._apply()
|
|
227
|
+
self._circuit = []
|
|
228
|
+
# else: Defer application until shots or expectation values are requested
|
|
229
|
+
|
|
230
|
+
def _apply(self):
|
|
231
|
+
for op in self._circuit:
|
|
220
232
|
if isinstance(op, QubitStateVector):
|
|
221
233
|
self._apply_qubit_state_vector(op)
|
|
222
234
|
elif isinstance(op, BasisState):
|
|
@@ -647,20 +659,36 @@ class QrackDevice(QubitDevice):
|
|
|
647
659
|
# estimate the ev
|
|
648
660
|
return np.mean(self.sample(observable))
|
|
649
661
|
|
|
662
|
+
def _generate_sample(self):
|
|
663
|
+
rev_sample = self._state.m_all()
|
|
664
|
+
sample = 0
|
|
665
|
+
for i in range(self.num_wires):
|
|
666
|
+
if (rev_sample & (1 << i)) > 0:
|
|
667
|
+
sample |= 1 << (self.num_wires - (i + 1))
|
|
668
|
+
return sample
|
|
669
|
+
|
|
650
670
|
def generate_samples(self):
|
|
651
671
|
if self.shots is None:
|
|
652
|
-
raise
|
|
672
|
+
raise QuantumFunctionError(
|
|
653
673
|
"The number of shots has to be explicitly set on the device "
|
|
654
674
|
"when using sample-based measurements."
|
|
655
675
|
)
|
|
656
676
|
|
|
677
|
+
if self.noise != 0:
|
|
678
|
+
samples = []
|
|
679
|
+
for _ in range(self.shots):
|
|
680
|
+
self._state.reset_all()
|
|
681
|
+
self._apply()
|
|
682
|
+
samples.append(self._generate_sample())
|
|
683
|
+
self._samples = QubitDevice.states_to_binary(np.array(samples), self.num_wires)
|
|
684
|
+
self._circuit = []
|
|
685
|
+
|
|
686
|
+
return self._samples
|
|
687
|
+
|
|
657
688
|
if self.shots == 1:
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
if (rev_sample & (1 << i)) > 0:
|
|
662
|
-
sample |= 1 << (self.num_wires - (i + 1))
|
|
663
|
-
self._samples = QubitDevice.states_to_binary(np.array([sample]), self.num_wires)
|
|
689
|
+
self._samples = QubitDevice.states_to_binary(
|
|
690
|
+
np.array([self._generate_sample()]), self.num_wires
|
|
691
|
+
)
|
|
664
692
|
|
|
665
693
|
return self._samples
|
|
666
694
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
pennylane_qrack/CMakeCache.txt,sha256=SqPMf-mg1R1CvN9iEW0oO-5uja146cRHYJ_4L1Rzc-M,16100
|
|
2
|
+
pennylane_qrack/Makefile,sha256=WgHeF4eQjsjX_OjNyuhzcuo1-YJMsVX9j82iABayQAQ,7789
|
|
3
|
+
pennylane_qrack/QrackDeviceConfig.toml,sha256=t_IQVSFR-GJ3VuqpQqm4M5gA3TVL4-y0qPq-f0FJwac,6219
|
|
4
|
+
pennylane_qrack/__init__.py,sha256=_g4NKu07_pXqxvQaxjdAPe769S5tWwYjqyHi3z7YKHc,673
|
|
5
|
+
pennylane_qrack/_version.py,sha256=5C2wPWY_CU6Br-x-4lRUtK2tJJfVKEqKzaBwkhyy0e8,692
|
|
6
|
+
pennylane_qrack/cmake_install.cmake,sha256=dmMUx-ivWcELMTui1SWnnN_Jxw0s4hwgBYdGF--L8rI,3088
|
|
7
|
+
pennylane_qrack/libqrack_device.dylib,sha256=rsyDdMTqQV4dkicfhI5BZZN19F7zYjq1NnhSfzSlOq0,2946528
|
|
8
|
+
pennylane_qrack/qrack_device.cpp,sha256=eRoowI7n9XV63aoZEaDjWmK1NC4JQ1GBeL2uggDttG0,36846
|
|
9
|
+
pennylane_qrack/qrack_device.py,sha256=JMMV6yiLg97qcEZjioLfTlqIW6Tq5vnVG6pTtT4MkDI,26943
|
|
10
|
+
pennylane_qrack-0.10.4.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
11
|
+
pennylane_qrack-0.10.4.dist-info/METADATA,sha256=aAxeWAf-HePykrP5fw5WmdnlrfvaOnRcM99dheoIMlg,5525
|
|
12
|
+
pennylane_qrack-0.10.4.dist-info/WHEEL,sha256=TDv-5Q9jJVEbUyNu42LU9Oimw5zgp_TWJrwih-3m70Q,106
|
|
13
|
+
pennylane_qrack-0.10.4.dist-info/entry_points.txt,sha256=V6f1sN6IZZZaEvxrI47A3K_kksp8fDUWjLWD0Met7Ww,79
|
|
14
|
+
pennylane_qrack-0.10.4.dist-info/top_level.txt,sha256=5NFMNHqCHtVLwNkLg66xz846uUJAlnOJ5VGa6ulW1ow,16
|
|
15
|
+
pennylane_qrack-0.10.4.dist-info/RECORD,,
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
pennylane_qrack/CMakeCache.txt,sha256=oJLJEP0qWZDVs0ifnB8MHYEQ8rnL2xV_9TnCC1tfHds,16093
|
|
2
|
-
pennylane_qrack/Makefile,sha256=WgHeF4eQjsjX_OjNyuhzcuo1-YJMsVX9j82iABayQAQ,7789
|
|
3
|
-
pennylane_qrack/QrackDeviceConfig.toml,sha256=t_IQVSFR-GJ3VuqpQqm4M5gA3TVL4-y0qPq-f0FJwac,6219
|
|
4
|
-
pennylane_qrack/__init__.py,sha256=_g4NKu07_pXqxvQaxjdAPe769S5tWwYjqyHi3z7YKHc,673
|
|
5
|
-
pennylane_qrack/_version.py,sha256=wPzzxyCbgXdn3mdSkz3Gkpepi4x5Ik58UXi07BhMazA,692
|
|
6
|
-
pennylane_qrack/cmake_install.cmake,sha256=dmMUx-ivWcELMTui1SWnnN_Jxw0s4hwgBYdGF--L8rI,3088
|
|
7
|
-
pennylane_qrack/libqrack_device.dylib,sha256=U_UXfJDGGTL0F0aRTUSxLGigq6JDzFU9PZ40JXk0E70,2993056
|
|
8
|
-
pennylane_qrack/qrack_device.cpp,sha256=eRoowI7n9XV63aoZEaDjWmK1NC4JQ1GBeL2uggDttG0,36846
|
|
9
|
-
pennylane_qrack/qrack_device.py,sha256=tN_RPJU8m4yr7AMfJQb6apRNxCKyX1XCIxpVwFo-2jw,26001
|
|
10
|
-
pennylane_qrack-0.10.1.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
11
|
-
pennylane_qrack-0.10.1.dist-info/METADATA,sha256=qGF858MmBaqNLGPk68IDYcAPF3bBHtEGL7kpmCBJrOQ,5525
|
|
12
|
-
pennylane_qrack-0.10.1.dist-info/WHEEL,sha256=BZzJDu0Q1LtbziRAAlgMgTY67RJKuVuaJsKx_8aR70k,106
|
|
13
|
-
pennylane_qrack-0.10.1.dist-info/entry_points.txt,sha256=V6f1sN6IZZZaEvxrI47A3K_kksp8fDUWjLWD0Met7Ww,79
|
|
14
|
-
pennylane_qrack-0.10.1.dist-info/top_level.txt,sha256=5NFMNHqCHtVLwNkLg66xz846uUJAlnOJ5VGa6ulW1ow,16
|
|
15
|
-
pennylane_qrack-0.10.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|