GroupMeasIntoBoxes¶
- class samplomatic.transpiler.passes.GroupMeasIntoBoxes(*args, **kwargs)[source]¶
Bases:
TransformationPassCollect 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:
'twirl'for aTwirlannotation.'change_basis'for aChangeBasisannotation with mode'measure'.'all'for bothTwirlandChangeBasisannotations.
prefix_ref – A prefix to all the
ChangeBasis.refgenerated by this class. Everyrefis generated by appending a counter toprefix_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 newrefis created.
Methods Summary
run(dag)Collect the operations in the dag inside left-dressed boxes.
Methods Documentation
- run(dag: DAGCircuit) DAGCircuit[source]¶
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 opological ordering.
When looping is complete, replace each group with a box.