Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
multiphaseCFD committed Sep 20, 2024
1 parent 05ee305 commit d1db2bc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 3 additions & 0 deletions pennylane_lightning/core/_serialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,9 @@ def _pauli_word(self, observable, wires_map: dict = None):
def map_wire(wire: int):
return wires_map[wire] if wires_map else wire

if len(observable) == 0:
return self.named_obs(PAULI_NAME_MAP["I"], [map_wire(0)])

if len(observable) == 1:
wire, pauli = list(observable.items())[0]
return self.named_obs(PAULI_NAME_MAP[pauli], [map_wire(wire)])
Expand Down
5 changes: 2 additions & 3 deletions tests/test_execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ class TestQChem:
def test_VQE_gradients(self, diff_method, tol):
"""Test if the VQE procedure returns the expected gradients."""

if qml.operation.active_new_opmath() and device_name == "lightning.tensor":
pytest.skip("The new operation math is not yet fully supported for lightning.tensor")

symbols = ["H", "H"]

geometry = np.array(
Expand Down Expand Up @@ -71,6 +68,8 @@ def test_VQE_gradients(self, diff_method, tol):

qml.expval(H)

# print(H)

num_params = len(excitations)
tape.trainable_params = np.linspace(1, num_params, num_params, dtype=int).tolist()

Expand Down

0 comments on commit d1db2bc

Please sign in to comment.