qml.pauli.diagonalize_qwc_pauli_words¶
- diagonalize_qwc_pauli_words(qwc_grouping)[source]¶
Diagonalizes a list of mutually qubit-wise commutative Pauli words.
- Parameters
qwc_grouping (list[Observable]) – a list of observables containing mutually qubit-wise commutative Pauli words
- Returns
list[Operation]: an instance of the qwc_rotation template which diagonalizes the qubit-wise commuting grouping
list[Observable]: list of Pauli string observables diagonal in the computational basis
- Return type
tuple
- Raises
ValueError – if any 2 elements in the input QWC grouping are not qubit-wise commutative
Example
>>> qwc_group = [qml.X(0) @ qml.Z(1), qml.X(0) @ qml.Y(3), qml.Z(1) @ qml.Y(3)] >>> diagonalize_qwc_pauli_words(qwc_group) ([RY(-1.5707963267948966, wires=[0]), RX(1.5707963267948966, wires=[3])], [Z(0) @ Z(1), Z(0) @ Z(3), Z(1) @ Z(3)])
code/api/pennylane.pauli.diagonalize_qwc_pauli_words
Download Python script
Download Notebook
View on GitHub