Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove magic numbers in Lightning stopping_conditions #926

Merged
merged 7 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pennylane_lightning/core/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
Version number (major.minor.patch[-label])
"""

__version__ = "0.39.0-dev32"
__version__ = "0.39.0-dev33"
4 changes: 0 additions & 4 deletions pennylane_lightning/core/lightning_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,6 @@ def stopping_condition(self):
and observable) and returns ``True`` if supported by the device."""

def accepts_obj(obj):
if isinstance(obj, qml.QFT):
return len(obj.wires) < 10
if isinstance(obj, qml.GroverOperator):
return len(obj.wires) < 13
is_not_tape = not isinstance(obj, qml.tape.QuantumTape)
is_supported = getattr(self, "supports_operation", lambda name: False)(obj.name)
return is_not_tape and is_supported
Expand Down
4 changes: 0 additions & 4 deletions pennylane_lightning/lightning_kokkos/lightning_kokkos.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,6 @@ def stopping_condition(op: Operator) -> bool:
"""A function that determines whether or not an operation is supported by ``lightning.kokkos``."""
# To avoid building matrices beyond the given thresholds.
maliasadi marked this conversation as resolved.
Show resolved Hide resolved
# This should reduce runtime overheads for larger systems.
if isinstance(op, qml.QFT):
return len(op.wires) < 10
if isinstance(op, qml.GroverOperator):
return len(op.wires) < 13
if isinstance(op, qml.PauliRot):
word = op._hyperparameters["pauli_word"] # pylint: disable=protected-access
# decomposes to IsingXX, etc. for n <= 2
Expand Down
7 changes: 0 additions & 7 deletions pennylane_lightning/lightning_qubit/lightning_qubit.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,6 @@

def stopping_condition(op: Operator) -> bool:
"""A function that determines whether or not an operation is supported by ``lightning.qubit``."""
# To avoid building matrices beyond the given thresholds.
# This should reduce runtime overheads for larger systems.
if isinstance(op, qml.QFT):
return len(op.wires) < 10
maliasadi marked this conversation as resolved.
Show resolved Hide resolved
if isinstance(op, qml.GroverOperator):
return len(op.wires) < 13

# As ControlledQubitUnitary == C(QubitUnitrary),
# it can be removed from `_operations` to keep
# consistency with `lightning_qubit.toml`
Expand Down
5 changes: 0 additions & 5 deletions pennylane_lightning/lightning_tensor/lightning_tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,6 @@ def stopping_condition(op: Operator) -> bool:
"""A function that determines whether or not an operation is supported by the ``mps`` method of ``lightning.tensor``."""
# TODOs: These thresholds are from ``lightning.qubit`` and should be adjuested based on the benchmarking tests for the MPS
maliasadi marked this conversation as resolved.
Show resolved Hide resolved
# simulator (against both max_mps_bond_dim and number of qubits).
if isinstance(op, qml.QFT):
return len(op.wires) < 10
if isinstance(op, qml.GroverOperator):
return len(op.wires) < 13

if isinstance(op, qml.ControlledQubitUnitary):
return True

Expand Down