qml.grouping.diagonalize_pauli_word

diagonalize_pauli_word(pauli_word)[source]

Transforms the Pauli word to diagonal form in the computational basis.

Parameters

pauli_word (Observable) – the Pauli word to diagonalize in computational basis

Returns

the Pauli word diagonalized in the computational basis

Return type

Observable

Raises

TypeError – if the input is not a Pauli word, i.e., a Pauli operator, Identity, or Tensor instances thereof

Example

>>> diagonalize_pauli_word(qml.PauliX('a') @ qml.PauliY('b') @ qml.PauliZ('c'))
PauliZ(wires=['a']) @ PauliZ(wires=['b']) @ PauliZ(wires=['c'])