Skip to content

Commit

Permalink
Update format
Browse files Browse the repository at this point in the history
  • Loading branch information
maliasadi committed Sep 24, 2024
1 parent 9e85126 commit 11d72a1
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 13 deletions.
8 changes: 6 additions & 2 deletions mpitests/test_adjoint_jacobian.py
Original file line number Diff line number Diff line change
Expand Up @@ -1384,7 +1384,9 @@ def test_qubit_unitary(dev, n_targets):

np.random.seed(1337)
par = 2 * np.pi * np.random.rand(n_wires)
U = np.random.rand(2**n_targets, 2**n_targets) + 1j * np.random.rand(2**n_targets, 2**n_targets)
U = np.random.rand(2**n_targets, 2**n_targets) + 1j * np.random.rand(
2**n_targets, 2**n_targets
)
U, _ = np.linalg.qr(U)
init_state = np.random.rand(2**n_wires) + 1j * np.random.rand(2**n_wires)
init_state /= np.sqrt(np.dot(np.conj(init_state), init_state))
Expand Down Expand Up @@ -1432,7 +1434,9 @@ def test_diff_qubit_unitary(dev, n_targets):

np.random.seed(1337)
par = 2 * np.pi * np.random.rand(n_wires)
U = np.random.rand(2**n_targets, 2**n_targets) + 1j * np.random.rand(2**n_targets, 2**n_targets)
U = np.random.rand(2**n_targets, 2**n_targets) + 1j * np.random.rand(
2**n_targets, 2**n_targets
)
U, _ = np.linalg.qr(U)
init_state = np.random.rand(2**n_wires) + 1j * np.random.rand(2**n_wires)
init_state /= np.sqrt(np.dot(np.conj(init_state), init_state))
Expand Down
4 changes: 3 additions & 1 deletion pennylane_lightning/core/_serialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,9 @@ def serialize_observables(self, tape: QuantumTape, wires_map: dict = None) -> Li
obs_indices.append(i)
return serialized_obs, obs_indices

def serialize_ops(self, tape: QuantumTape, wires_map: dict = None) -> Tuple[
def serialize_ops(
self, tape: QuantumTape, wires_map: dict = None
) -> Tuple[
List[List[str]],
List[np.ndarray],
List[List[int]],
Expand Down
1 change: 0 additions & 1 deletion pennylane_lightning/core/_state_vector_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ class LightningBaseStateVector(ABC):
"""

def __init__(self, num_wires: int, dtype: Union[np.complex128, np.complex64]):

if dtype not in [np.complex64, np.complex128]:
raise TypeError(f"Unsupported complex type: {dtype}")

Expand Down
1 change: 0 additions & 1 deletion pennylane_lightning/lightning_kokkos/_measurements.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ def __init__(
self,
kokkos_state,
) -> None:

super().__init__(kokkos_state)

self._measurement_lightning = self._measurement_dtype()(kokkos_state.state_vector)
Expand Down
2 changes: 0 additions & 2 deletions pennylane_lightning/lightning_kokkos/_state_vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ def __init__(
kokkos_args=None,
sync=True,
): # pylint: disable=too-many-arguments

super().__init__(num_wires, dtype)

self._device_name = "lightning.kokkos"
Expand Down Expand Up @@ -280,7 +279,6 @@ def _apply_lightning(
elif isinstance(operation, qml.ops.Controlled) and isinstance(
operation.base, qml.GlobalPhase
): # apply n-controlled gate

# Kokkos do not support the controlled gates except for GlobalPhase
self._apply_lightning_controlled(operation)
else: # apply gate as a matrix
Expand Down
1 change: 0 additions & 1 deletion pennylane_lightning/lightning_qubit/_measurements.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ def __init__(
kernel_name: str = None,
num_burnin: int = None,
) -> None:

super().__init__(qubit_state)

self._mcmc = mcmc
Expand Down
1 change: 0 additions & 1 deletion pennylane_lightning/lightning_qubit/_state_vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ class LightningStateVector(LightningBaseStateVector): # pylint: disable=too-few
"""

def __init__(self, num_wires, dtype=np.complex128):

super().__init__(num_wires, dtype)

self._device_name = "lightning.qubit"
Expand Down
1 change: 0 additions & 1 deletion tests/lightning_qubit/test_jacobian_method.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ def calculate_reference(tape, execute_and_derivatives=False):

@staticmethod
def process_and_execute(statevector, tape, execute_and_derivatives=False):

wires = statevector.num_wires
device = LightningDevice(wires)
if execute_and_derivatives:
Expand Down
8 changes: 6 additions & 2 deletions tests/test_adjoint_jacobian.py
Original file line number Diff line number Diff line change
Expand Up @@ -1550,7 +1550,9 @@ def test_qubit_unitary(n_targets):
init_state = np.random.rand(2**n_wires) + 1j * np.random.rand(2**n_wires)
init_state /= np.linalg.norm(init_state)
init_state = np.array(init_state, requires_grad=False)
U = np.random.rand(2**n_targets, 2**n_targets) + 1j * np.random.rand(2**n_targets, 2**n_targets)
U = np.random.rand(2**n_targets, 2**n_targets) + 1j * np.random.rand(
2**n_targets, 2**n_targets
)
U, _ = np.linalg.qr(U)
U = np.array(U, requires_grad=False)

Expand Down Expand Up @@ -1592,7 +1594,9 @@ def test_diff_qubit_unitary(n_targets):
init_state = np.random.rand(2**n_wires) + 1j * np.random.rand(2**n_wires)
init_state /= np.linalg.norm(init_state)
init_state = np.array(init_state, requires_grad=False)
U = np.random.rand(2**n_targets, 2**n_targets) + 1j * np.random.rand(2**n_targets, 2**n_targets)
U = np.random.rand(2**n_targets, 2**n_targets) + 1j * np.random.rand(
2**n_targets, 2**n_targets
)
U, _ = np.linalg.qr(U)
U = np.array(U, requires_grad=False)

Expand Down
1 change: 0 additions & 1 deletion tests/test_native_mcm.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ def func(x, y):
):
func(*params)
if device_name == "lightning.kokkos":

with pytest.raises(
qml.DeviceError,
match=r"Measurement shadow\(wires=\[0\]\) not accepted with finite shots on "
Expand Down

0 comments on commit 11d72a1

Please sign in to comment.