pennylane
pennylane copied to clipboard
Add `pauli_rep` properties for common static gates
Feature details
The pauli_rep
property allows to represent an operator as a PauliSentence
instance.
Currently, it is mostly implemented for qml.X, qml.Y, qml.Z
and for operator math classes.
It would be great to have pauli_rep
attributes for, e.g., Clifford gates (Hadamard
, S
, CNOT
), but also for other ops.
This would simplify manipulation of qml.pauli
objects.
This came up while writing this demo, where we currently have to do
new_op = qml.CNOT([0, 1]) @ original_op @ qml.CNOT([0, 1])
new_op = qml.pauli_decompose(new_op.matrix())
i.e., we have to go via the dense matrix representation to obtain the new operator. With qml.CNOT.pauli_rep
implemented, we could stay in the more efficient Pauli representation.
Implementation
Basically trivial, as far as I can tell.
How important would you say this feature is?
1: Not important. Would be nice to have.
Additional information
No response