qml.pauli.are_identical_pauli_words¶
-
are_identical_pauli_words
(pauli_1, pauli_2)[source]¶ Performs a check if two Pauli words have the same
wires
andname
attributes.This is a convenience function that checks if two given
Tensor
instances specify the same Pauli word. This function only checks if bothTensor
instances have the same wires and name attributes, and hence won’t perform any simplification to identify if the two Pauli words are algebraically equivalent. For instance, this function will not identify thatPauliX(0) @ PauliX(0) = Identity(0)
, orPauliX(0) @ Identity(1) = PauliX(0)
, orIdentity(0) = Identity(1)
, etc.- Parameters
- Returns
whether
pauli_1
andpauli_2
have the same wires and name attributes- Return type
bool
- Raises
TypeError – if
pauli_1
orpauli_2
are notIdentity
,PauliX
,PauliY
,PauliZ
, orTensor
instances
Example
>>> are_identical_pauli_words(qml.PauliZ(0) @ qml.PauliZ(1), qml.PauliZ(0) @ qml.PauliZ(1)) True >>> are_identical_pauli_words(qml.PauliZ(0) @ qml.PauliZ(1), qml.PauliZ(0) @ qml.PauliX(3)) False