qml.transforms.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 not executable on any backend. This pass is only for Pauli-based-computation analysis with thenull.qubitdevice and potential future execution when a suitable backend is available.Lastly, the
pennylane.transforms.to_ppr()transform must be applied beforedecompose_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
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: 2 PPR-pi/2: 2 PPR-Phi: 1 Measurements: expval(PauliZ): 1
In the above output,
PPR-thetadenotes the type of PPR present in the circuit, wherethetais the PPR angle (\(\theta\)).PPR-Phicorresponds to a PPR whose angle of rotation is not \(\tfrac{\pi}{2}\), \(\tfrac{\pi}{4}\), or \(\tfrac{\pi}{8}\).