catalyst.passes.ppr_to_mbqc

ppr_to_mbqc(qnode)[source]

Specify that the MLIR compiler pass for lowering Pauli Product Rotations (PPR) and Pauli Product Measurements (PPM) to a measurement-based quantum computing (MBQC) style circuit will be applied.

This pass replaces QEC operations (qec.ppr and qec.ppm) with a gate-based sequence in the Quantum dialect using universal gates and measurements that supported as MBQC gate set. For details, see the Figure 2 of [Measurement-based Quantum Computation on cluster states](https://arxiv.org/abs/quant-ph/0301052).

Conceptually, each Pauli product is handled by:

  • Mapping its Pauli string to the Z basis via per-qubit conjugations (e.g., H for X; specialized RotXZX sequences for Y).

  • Accumulating parity onto the first qubit with a right-to-left CNOT ladder.

  • Emitting the kernel operation: - PPR: apply an RZ with an angle derived from the rotation kind. - PPM: perform a measurement and return an i1 result.

  • Uncomputing by reversing the CNOT ladder and the conjugations.

  • Conjugating the qubits back to the original basis.

Note

This pass expects PPR/PPM operations to be present. In practice, use it after to_ppr() and/or commute_ppr() and/or merge_ppr_ppm().

Parameters:

fn (QNode) – QNode to apply the pass to.

Returns:

QNode

Example

Convert a simple Clifford+T circuit to PPRs, then lower them to an MBQC-style circuit. Note that this pass should be applied before ppr_to_ppm() since it requires the actual PPR/PPM operations.

import pennylane as qml
import catalyst

p = [("my_pipe", ["quantum-compilation-stage"])]

@qml.qjit(pipelines=p, target="mlir", keep_intermediate=True)
@catalyst.passes.ppr_to_mbqc
@catalyst.passes.to_ppr
@qml.qnode(qml.device("null.qubit", wires=2))
def circuit():
    qml.H(0)
    qml.CNOT([0, 1])
    return

print(circuit.mlir_opt)

Because Catalyst does not currently support execution of Pauli-based computation operations, we must halt the pipeline after quantum-compilation-stage. This ensures that only the quantum passes will be applied to the initial MLIR, without attempting to further compile for execution.

Example MLIR excerpt (structure only):