pauli_mult_with_phase(pauli_1, pauli_2, wire_map=None)¶
Multiply two Pauli words together, and return both their product as a Pauli word and the global phase.
Two Pauli operations can be multiplied together by taking the additive OR of their binary symplectic representations. The phase is computed by looking at the number of times we have the products \(XY, YZ\), or \(ZX\) (adds a phase of \(i\)), or \(YX, ZY, XZ\) (adds a phase of \(-i\)).
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.
The product of
pauli_2, and the global phase.
- Return type
This function works the same as
pauli_mult()but also returns the global phase accumulated as a result of the ordering of Paulis in the product (e.g., \(XY = iZ\), and \(YX = -iZ\)).
>>> from pennylane.grouping import pauli_mult_with_phase >>> pauli_1 = qml.PauliX(0) @ qml.PauliZ(1) >>> pauli_2 = qml.PauliY(0) @ qml.PauliZ(1) >>> product, phase = pauli_mult_with_phase(pauli_1, pauli_2) >>> product PauliZ(wires=) >>> phase 1j