Skip to content

Commit

Permalink
update _apply_lightning
Browse files Browse the repository at this point in the history
  • Loading branch information
multiphaseCFD committed Sep 12, 2024
1 parent ea777e4 commit 8776fb5
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions pennylane_lightning/lightning_tensor/_tensornet.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,13 +386,12 @@ def _apply_lightning(self, operations):
if len(list(operation.target_wires)) == 1: # use cutensornet's default support
self._apply_lightning_controlled(operation)
else:
control_wires = list(operation.control_wires)
control_values = operation.control_values
name = operation.name
# Apply GlobalPhase
wires = self.wires.indices(operation.wires)
if isinstance(operation.base, qml.GlobalPhase):
param = operation.parameters[0]
control_wires = list(operation.control_wires)
control_values = operation.control_values
wires = self.wires
matrix = global_phase_diagonal(

Check warning on line 395 in pennylane_lightning/lightning_tensor/_tensornet.py

View check run for this annotation

Codecov / codecov/patch

pennylane_lightning/lightning_tensor/_tensornet.py#L391-L395

Added lines #L391 - L395 were not covered by tests
param, self.wires, control_wires, control_values
)
Expand Down Expand Up @@ -427,12 +426,6 @@ def _apply_lightning(self, operations):
except AttributeError:
gate_ops_matrix = operation.matrix()

Check warning on line 427 in pennylane_lightning/lightning_tensor/_tensornet.py

View check run for this annotation

Codecov / codecov/patch

pennylane_lightning/lightning_tensor/_tensornet.py#L426-L427

Added lines #L426 - L427 were not covered by tests

if gate_ops_matrix.shape != (2 ** len(wires), 2 ** len(wires)):
# TODO: get the full matrix reprensentation of the gate, epscially for the controlled gates and others
raise ValueError(
f"Operation matrix of {operation.name} must be of shape (2**len(wires), 2**len(wires))."
)

self._apply_MPO(gate_ops_matrix, wires)

def apply_operations(self, operations):
Expand Down

0 comments on commit 8776fb5

Please sign in to comment.