catalyst.passes.decompose_arbitrary_ppr

decompose_arbitrary_ppr(qnode)[source]

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 executable on lightning.qubit or null.qubit (for mock-execution).

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

See also

to_ppr(), commute_ppr(), merge_ppr_ppm(), ppr_to_ppm(), ppm_compilation(), reduce_t_depth()

Note

For better compatibility with other PennyLane functionality, ensure that PennyLane program capture is enabled with @qjit(capture=True).

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.qjit(capture=True)
@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=2)())
Device: null.qubit
Device wires: 3
Shots: Shots(total=None)
Level: decompose-arbitrary-ppr

Wire allocations: 3
Total gates: 6
Gate counts:
- pbc.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
Depth: Not computed

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}\).