catalyst.passes.ppr_to_ppm

ppr_to_ppm(qnode)[source]

Specify that the MLIR compiler pass for absorbing Clifford Pauli Product Rotation (PPR) operations, \(\exp{iP\tfrac{\pi}{4}}\), into the final Pauli Product Measurement (PPM) will be applied.

For more information regarding to PPM, check out the compilation hub.

Parameters

fn (QNode) – QNode to apply the pass to

Returns

~.QNode

Example

In this example, the Clifford+T gates will be converted into PPRs first, then the Clifford PPRs will be commuted past the non-Clifford PPR, and finally the Clifford PPRs will be absorbed into the Pauli Product Measurements.

import pennylane as qml
from catalyst import qjit, measure

ppm_passes = [("PPM",["to_ppr", "commute_ppr","ppr_to_ppm",])]

@qjit(pipelines=ppm_passes, keep_intermediate=True, target="mlir")
@qml.qnode(qml.device("lightning.qubit", wires=1))
def circuit():
    qml.H(0)
    qml.T(0)
    return measure(0)

print(circuit.mlir_opt)

Example MLIR Representation:

. . .
%2 = qec.ppr ["X"](8) %1 : !quantum.bit
%mres, %out_qubits = qec.ppm ["X"] %2 : !quantum.bit
. . .