Skip to content

Commit

Permalink
oooops
Browse files Browse the repository at this point in the history
  • Loading branch information
astralcai committed Sep 19, 2024
1 parent 796fb7a commit 8decdbb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pennylane/ops/op_math/adjoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,11 @@ def matrix(self, wire_order=None):

return moveaxis(conj(base_matrix), -2, -1)

# pylint: disable=arguments-renamed, invalid-overridden-method
@property
def has_sparse_matrix(self) -> bool:
return self.base.has_sparse_matrix

# pylint: disable=arguments-differ
def sparse_matrix(self, wire_order=None, format="csr"):
base_matrix = self.base.sparse_matrix(wire_order=wire_order)
Expand Down
5 changes: 5 additions & 0 deletions pennylane/ops/op_math/pow.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,11 @@ def _matrix(scalar, mat):

return fractional_matrix_power(mat, scalar)

# pylint: disable=arguments-renamed, invalid-overridden-method
@property
def has_sparse_matrix(self) -> bool:
return self.base.has_sparse_matrix and isinstance(self.z, int)

# pylint: disable=arguments-differ
@staticmethod
def compute_sparse_matrix(*params, base=None, z=0):
Expand Down

0 comments on commit 8decdbb

Please sign in to comment.