qml.grouping.pauli_mult

pauli_mult(pauli_1, pauli_2, wire_map=None)[source]

Multiply two Pauli words together and return the product as a Pauli word.

Two Pauli operations can be multiplied together by taking the additive OR of their binary symplectic representations.

Parameters
  • pauli_1 (Operation) – A Pauli word.

  • pauli_2 (Operation) – A Pauli word to multiply with the first one.

  • wire_map (dict[Union[str, int], int]) – dictionary containing all wire labels used in the Pauli word as keys, and unique integer labels as their values. If no wire map is provided, the map will be constructed from the set of wires acted on by the input Pauli words.

Returns

The product of pauli_1 and pauli_2 as a Pauli word (ignoring the global phase).

Return type

Operation

Example

This function enables multiplication of Pauli group elements at the level of Pauli words, rather than matrices. For example,

>>> from pennylane.grouping import pauli_mult
>>> pauli_1 = qml.PauliX(0) @ qml.PauliZ(1)
>>> pauli_2 = qml.PauliY(0) @ qml.PauliZ(1)
>>> product = pauli_mult(pauli_1, pauli_2)
>>> print(product)
PauliZ(wires=[0])