-
Notifications
You must be signed in to change notification settings - Fork 707
Closed
Labels
bug 🐛Something isn't workingSomething isn't working
Description
Expected behavior
class DummyOp(qml.operation.Operator):
pass
(DummyOp(0) ** 2 ).simplify()
simplifies the operator into a product.
Actual behavior
class DummyOp(qml.operation.Operator):
pass
(DummyOp(0) ** 2 ).simplify()
throws a recursion error.
Additional information
No response
Source code
Tracebacks
RecursionError: maximum recursion depth exceeded in comparison
The above exception was the direct cause of the following exception:
RuntimeError Traceback (most recent call last)
/usr/local/lib/python3.11/dist-packages/pennylane/ops/op_math/composite.py in wrapper(*args, **kwargs)
37 return func(*args, **kwargs)
38 except RecursionError as e:
---> 39 raise RuntimeError(
40 "Maximum recursion depth reached! This is likely due to nesting too many levels "
41 "of composite operators. Try setting lazy=False when calling qml.sum, qml.prod, "
RuntimeError: Maximum recursion depth reached! This is likely due to nesting too many levels of composite operators. Try setting lazy=False when calling qml.sum, qml.prod, and qml.s_prod, or use the +, @, and * operators instead. Alternatively, you can periodically call qml.simplify on your operators.System information
Name: pennylane
Version: 0.42.1
Summary: PennyLane is a cross-platform Python library for quantum computing, quantum machine learning, and quantum chemistry. Train a quantum computer the same way as a neural network.
Home-page:
Author:
Author-email:
License:
Location: /usr/local/lib/python3.11/dist-packages
Requires: appdirs, autograd, autoray, cachetools, diastatic-malt, networkx, numpy, packaging, pennylane-lightning, requests, rustworkx, scipy, tomlkit, typing_extensions
Required-by: pennylane_lightning
Platform info: Linux-6.1.123+-x86_64-with-glibc2.35
Python version: 3.11.13
Numpy version: 2.0.2
Scipy version: 1.16.1
Installed devices:
- default.clifford (pennylane-0.42.1)
- default.gaussian (pennylane-0.42.1)
- default.mixed (pennylane-0.42.1)
- default.qubit (pennylane-0.42.1)
- default.qutrit (pennylane-0.42.1)
- default.qutrit.mixed (pennylane-0.42.1)
- default.tensor (pennylane-0.42.1)
- null.qubit (pennylane-0.42.1)
- reference.qubit (pennylane-0.42.1)
- lightning.qubit (pennylane_lightning-0.42.0)Existing GitHub issues
- I have searched existing GitHub issues to make sure the issue does not already exist.
Metadata
Metadata
Assignees
Labels
bug 🐛Something isn't workingSomething isn't working