-
Notifications
You must be signed in to change notification settings - Fork 627
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
introduce QubitDevice._get_diagonalizing_gates; skip Hamiltonian in default.qubit #3938
Conversation
Hello. You may have forgotten to update the changelog!
|
Codecov Report
@@ Coverage Diff @@
## master #3938 +/- ##
=======================================
Coverage 99.74% 99.74%
=======================================
Files 345 345
Lines 30164 30171 +7
=======================================
+ Hits 30086 30093 +7
Misses 78 78
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm quite happy with these changes. I like the shift of moving diagonalizing gates to the device from the qscript a lot. Thanks Matt!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure to add a changelog!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me 👍
…efault.qubit (#3938) * introduce QubitDevice.get_diagonalizing_gates; skip Hamiltonian in default.qubit * fix filter in default.qubit * make method private; add tests * default uses tape property; add type hints * changelog entry * trigger ci * move to improvements in changelog
Context:
Can be done instead of #3929. Some devices compute diagonalizing gates, and this can be costly. If they aren't going to be used, a device should be able to skip trying.
Description of the Change:
_get_diagonalizing_gates
to theQubitDevice
class. It is a copy-paste of theQuantumScript.diagonalizing_gates
property.circuit.diagonalizing_gates
withself._get_diagonalizing_gates(circuit)
inQubitDevice.execute
(when it callsself.apply
).DefaultQubit
to filter out any measurements withisinstance(m.obs, qml.Hamiltonian)
.Benefits:
QuantumTape.diagonalizing_gates
, whose reason for existence is questionablePossible Drawbacks:
default.qubit
that needs maintenance/porting overQuantumScript.diagonalizing_gates
codeAdditional Notes
get_
on purpose, to show that it's doing something (unlike the aforementioned property which was intentionally hiding that fact), and to distinguish it from existing code. Again, I can change this if people prefer itRelated GitHub Issues:
#3929, blocks PennyLaneAI/pennylane-lightning#424