Closed glassnotes closed 3 years ago
Nice catch @glassnotes! The logic for both decomposition
and _matrix
methods assumes that the input string will contain at least one Pauli operator (non-Identity).
I think this should be straightforward to fix then, I can give it a go! :+1:
Great :) It's worth coordinating with @soranjh, as he also started picking up the details here.
This has been fixed in #860 :tada:
Issue description
When calling
PauliRot
with the all-identity Pauli, an error is thrown when PennyLane tries to perform a decomposition of the operation. This operation technically has no effect except adding a global phase; the context in which this came up was while looping through terms of a Hamiltonian (one of which was identity), and trying to perform e^{-it P} for each Pauli P.Example:
Expected behavior: The operation should do nothing (or add a global phase where applicable) when the identity Pauli is passed, instead of raising an error.
Actual behavior: Error message below.
Reproduces how often: Always
System information:
Source code and tracebacks