qml.grouping.is_pauli_word¶
-
is_pauli_word
(observable)[source]¶ Checks if an observable instance is a Pauli word.
- Parameters
observable (Observable) – an observable, either a
Tensor
instance or single-qubit observable.- Returns
true if the input observable is a Pauli word, false otherwise.
- Return type
bool
- Raises
TypeError – if input observable is not an Observable instance.
Example
>>> is_pauli_word(qml.Identity(0)) True >>> is_pauli_word(qml.PauliX(0) @ qml.PauliZ(2)) True >>> is_pauli_word(qml.PauliZ(0) @ qml.Hadamard(1)) False
code/api/pennylane.grouping.is_pauli_word
Download Python script
Download Notebook
View on GitHub