catalyst.passes.to_ppr¶
- to_ppr(qnode)[source]¶
A quantum compilation pass that converts Clifford+T gates into Pauli Product Rotation (PPR) gates.
Note
For improved integration with the PennyLane frontend, including inspectability with
pennylane.specs(), please usepennylane.transforms.to_ppr().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 the PPM compilation pass, check out the compilation hub.
Note
The circuits generated from this pass are currently only executable on the
lightning.qubitdevice with program capture enabled.The full list of supported gates and operations are
qml.H,qml.S,qml.T,qml.X,qml.Y,qml.Z,qml.adjoint(qml.S),qml.adjoint(qml.T),qml.CNOT,qml.PauliRot, andcatalyst.measure.- Parameters:
fn (QNode) – QNode to apply the pass to
- Returns:
Example
In this example the Clifford+T gates will be converted into PPRs.
import pennylane as qml import catalyst p = [("my_pipe", ["quantum-compilation-stage"])] @qml.qjit(pipelines=p, target="mlir") @catalyst.passes.to_ppr @qml.qnode(qml.device("null.qubit", wires=2)) def circuit(): qml.H(0) qml.CNOT([0, 1]) qml.T(0) return print(circuit.mlir_opt)
Example MLIR Representation:
. . . %2 = pbc.ppr ["Z"](4) %1 : !quantum.bit %3 = pbc.ppr ["X"](4) %2 : !quantum.bit %4 = pbc.ppr ["Z"](4) %3 : !quantum.bit %5 = quantum.extract %0[ 1] : !quantum.reg -> !quantum.bit %6:2 = pbc.ppr ["Z", "X"](4) %4, %5 : !quantum.bit, !quantum.bit %7 = pbc.ppr ["Z"](-4) %6#0 : !quantum.bit %8 = pbc.ppr ["X"](-4) %6#1 : !quantum.bit %9 = pbc.ppr ["Z"](8) %7 : !quantum.bit . . .