# qml.pauli.is_pauli_word¶

is_pauli_word(observable)[source]

Checks if an observable instance consists only of Pauli and Identity Operators.

Warning

This function will only confirm that all operators are Pauli or Identity operators, and not whether the Observable is mathematically a Pauli word. If an Observable consists of multiple Pauli operators targeting the same wire, the function will return True regardless of any complex coefficients.

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

Example

>>> is_pauli_word(qml.Identity(0))
True
>>> is_pauli_word(qml.PauliX(0) @ qml.PauliZ(2))
True