qml.transforms.decompose_arbitrary_ppr

decompose_arbitrary_ppr()

A quantum compilation pass that decomposes arbitrary-angle Pauli product rotations (PPRs) into a collection of PPRs (with angles of rotation of \(\tfrac{\pi}{2}\), \(\tfrac{\pi}{4}\), and \(\tfrac{\pi}{8}\)), PPMs and a single-qubit arbitrary-angle PPR in the Z basis. For details, see Figure 13(d) of arXiv:2211.15465.

Note

This transform requires decorating the workflow with @qml.qjit. In addition, the circuits generated by this pass are currently not executable on any backend. This pass is only for Pauli-based-computation analysis with the null.qubit device and potential future execution when a suitable backend is available.

Lastly, the pennylane.transforms.to_ppr() transform must be applied before decompose_arbitrary_ppr.

Parameters:

qnode (QNode) – QNode to apply the pass to.

Returns:

Returns decorated QNode.

Return type:

QNode

Note

For better compatibility with other PennyLane functionality, ensure that PennyLane program capture is enabled with pennylane.capture.enable().

Example

In the example below, the arbitrary-angle PPR (qml.PauliRot(0.1, pauli_word="XY", wires=[0, 1])), will be decomposed into various other PPRs and PPMs in accordance with Figure 13(d) of arXiv:2211.15465.

import pennylane as qml

qml.capture.enable()

@qml.qjit(target="mlir")
@qml.transforms.decompose_arbitrary_ppr
@qml.transforms.to_ppr
@qml.qnode(qml.device("null.qubit", wires=3))
def circuit():
    qml.PauliRot(0.1, pauli_word="XY", wires=[0, 1])
    return qml.expval(qml.Z(0))
>>> print(qml.specs(circuit, level=3)())
Device: null.qubit
Device wires: 3
Shots: Shots(total=None)
Level: 3

Resource specifications:
  Total wire allocations: 4
  Total gates: 6
  Circuit depth: Not computed

Gate types:
  qec.prepare: 1
  PPM-w3: 1
  PPM-w1: 1
  PPR-pi/2-w1: 1
  PPR-pi/2-w2: 1
  PPR-Phi-w1: 1

Measurements:
    expval(PauliZ): 1

In the above output, PPR-theta-w<int> denotes the type of PPR present in the circuit, where theta is the PPR angle (\(\theta\)) and w<int> denotes the PPR weight (the number of qubits it acts on, or the length of the Pauli word). PPM-w<int> follows the same convention. PPR-Phi-w<int> corresponds to a PPR whose angle of rotation is not \(\tfrac{\pi}{2}\), \(\tfrac{\pi}{4}\), or \(\tfrac{\pi}{8}\).