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
orProd
instances specify the same Pauli word.- 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
,Tensor
,SProd
, orProd
instances
Example
>>> are_identical_pauli_words(qml.Z(0) @ qml.Z(1), qml.Z(1) @ qml.Z(0)) True >>> are_identical_pauli_words(qml.I(0) @ qml.X(1), qml.X(1)) True >>> are_identical_pauli_words(qml.Z(0) @ qml.Z(1), qml.Z(0) @ qml.X(3)) False
code/api/pennylane.pauli.are_identical_pauli_words
Download Python script
Download Notebook
View on GitHub