qml.pauli.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.

Warning

pauli_mult is deprecated. Instead, you can multiply two Pauli words together with qml.simplify(qml.prod(pauli_1, pauli_2)). Note that if there is a phase, this will be in result.scalar, and the base will be available in result.base.

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.pauli import pauli_mult
>>> pauli_1 = qml.X(0) @ qml.Z(1)
>>> pauli_2 = qml.Y(0) @ qml.Z(1)
>>> product = pauli_mult(pauli_1, pauli_2)
>>> print(product)
Z(0)