Skip to main content
IBM Quantum Platform

GroupMeasIntoBoxes

class samplomatic.transpiler.passes.GroupMeasIntoBoxes(*args, **kwargs)

GitHub

Bases: TransformationPass

Collect the measurements in a circuit inside boxes.

This pass collects all of the measurements in the input circuit in boxes. To assign the measurements to these boxes, it uses a greedy collection strategy that tries to collect measurements in the earliest possible box that they can fit.

Parameters

  • annotations –

    The annotations placed on the measurement boxes. The supported values are:

  • decomposition –

    The gate sequence into which single-qubit dressing gates are synthesized.

    • 'rzsx' synthesizes single-qubit gates with rz-sx-rz-sx-rz.
    • 'rzrx' synthesizes single-qubit gates with rz-rx-rz.
  • prefix_ref – A prefix to all the ChangeBasis.ref generated by this class. Every ref is generated by appending a counter to prefix_ref. In order to avoid collisions, the counter is shared across all the instances of this class and it is incremented every time that a new ref is created.

Note

Barriers, boxes, two-qubit gates, and resets act as delimiters. This means that when the pass encounters one of these on a subset of qubits, it immediately terminates the collection for those qubits and flushes the collected measurements into a box.

Methods Summary

Column 1
Column 2
run(dag)Collect the operations in the dag inside left-dressed boxes.

Methods Documentation

run

run(dag: DAGCircuit) → DAGCircuit

GitHub

Collect the operations in the dag inside left-dressed boxes.

The collection strategy undertakes the following steps:

  • Loop through the DAG’s op nodes in topological order.
  • Group together measurement nodes to be placed in the same box.
  • Whenever a node can be placed in more than one group, place it in the earliest possible group–where “earliest” is with reference to topological ordering.
  • When looping is complete, replace each group with a box.
Was this page helpful?
Report a bug, typo, or request content on GitHub.