diff --git a/pennylane_qrack/qrack_device.py b/pennylane_qrack/qrack_device.py index c452499..59fbc55 100644 --- a/pennylane_qrack/qrack_device.py +++ b/pennylane_qrack/qrack_device.py @@ -24,7 +24,7 @@ import numpy as np -from pennylane import QubitDevice, DeviceError +from pennylane import QubitDevice, DeviceError, QuantumFunctionError from pennylane.ops import ( QubitStateVector, BasisState, @@ -175,30 +175,30 @@ def get_c_interface(): def __init__(self, wires=0, shots=None, **kwargs): options = dict(kwargs) - if 'isStabilizerHybrid' in options: - self.isStabilizerHybrid = options['isStabilizerHybrid'] - if 'isTensorNetwork' in options: - self.isTensorNetwork = options['isTensorNetwork'] - if 'isSchmidtDecompose' in options: - self.isSchmidtDecompose = options['isSchmidtDecompose'] - if 'isBinaryDecisionTree' in options: - self.isBinaryDecisionTree = options['isBinaryDecisionTree'] - if 'isOpenCL' in options: - self.isOpenCL = options['isOpenCL'] - if 'isHostPointer' in options: - self.isHostPointer = options['isHostPointer'] - if 'noise' in options: - self.noise = options['noise'] + if "isStabilizerHybrid" in options: + self.isStabilizerHybrid = options["isStabilizerHybrid"] + if "isTensorNetwork" in options: + self.isTensorNetwork = options["isTensorNetwork"] + if "isSchmidtDecompose" in options: + self.isSchmidtDecompose = options["isSchmidtDecompose"] + if "isBinaryDecisionTree" in options: + self.isBinaryDecisionTree = options["isBinaryDecisionTree"] + if "isOpenCL" in options: + self.isOpenCL = options["isOpenCL"] + if "isHostPointer" in options: + self.isHostPointer = options["isHostPointer"] + if "noise" in options: + self.noise = options["noise"] super().__init__(wires=wires, shots=shots) self._state = QrackSimulator( self.num_wires, - isStabilizerHybrid = self.isStabilizerHybrid, + isStabilizerHybrid=self.isStabilizerHybrid, isTensorNetwork=self.isTensorNetwork, isSchmidtDecompose=self.isSchmidtDecompose, isBinaryDecisionTree=self.isBinaryDecisionTree, isOpenCL=self.isOpenCL, isHostPointer=self.isHostPointer, - noise = self.noise + noise=self.noise, ) def _reverse_state(self): @@ -649,7 +649,7 @@ def expval(self, observable, **kwargs): def generate_samples(self): if self.shots is None: - raise qml.QuantumFunctionError( + raise QuantumFunctionError( "The number of shots has to be explicitly set on the device " "when using sample-based measurements." )