qml.transforms.to_ppr¶
- to_ppr(tape)[source]¶
A quantum compilation pass that converts Clifford+T gates into Pauli Product Rotation (PPR) gates.
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.Clifford gates are defined as \(\exp(-{iP\tfrac{\pi}{4}})\), where \(P\) is a Pauli word. Non-Clifford gates are defined as \(\exp(-{iP\tfrac{\pi}{8}})\).
For more information on Pauli product measurements and Pauli product rotations, check out the compilation hub.
The full list of supported gates and operations are
qml.H,qml.S,qml.T,qml.X,qml.Y,qml.Z,qml.PauliRot,qml.adjoint(qml.PauliRot),qml.adjoint(qml.S),qml.adjoint(qml.T),qml.CNOT, andqml.measure.See also
commute_ppr(),merge_ppr_ppm(),ppr_to_ppm(),ppm_compilation(),reduce_t_depth(),decompose_arbitrary_ppr()Note
For better compatibility with other PennyLane functionality, ensure that PennyLane program capture is enabled with
pennylane.capture.enable().Example
The
to_pprcompilation pass can be applied as a decorator on a QNode:import pennylane as qml qml.capture.enable() @qml.qjit(target="mlir") @qml.transforms.to_ppr @qml.qnode(qml.device("null.qubit", wires=2)) def circuit(): qml.H(0) qml.CNOT([0, 1]) m = qml.measure(0) qml.T(0) return qml.expval(qml.Z(0))
To inspect programs compiled with
to_pprviaspecs(), ensure thattarget="mlir"is given in theqjitdecorator.>>> print(qml.specs(circuit, level=2)()) Device: null.qubit Device wires: 2 Shots: Shots(total=None) Level: 2 Resource specifications: Total wire allocations: 2 Total gates: 8 Circuit depth: Not computed Gate types: PPR-pi/4: 6 PPM: 1 PPR-pi/8: 1 Measurements: expval(PauliZ): 1
In the above output,
PPR-thetadenotes the type of PPR present in the circuit, wherethetais the PPR angle (\(\theta\)). Note that the mid-circuit measurement (pennylane.measure()) in the circuit has been converted to a Pauli product measurement (PPM), as well.