You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Include &Packedinstruction in DAGCircuit::op_nodes iteration (Qiskit#13681)
Uses of the `DAGCircuit::op_nodes` iterator are almost invariably
followed by indexing into the DAG to retrieve the node weight, which is
dynamically asserted to be `NodeType::Operation`. Since the iterator
already verifies this, we can just include the unwrapped
`&PackedInstruction` in the iterator return to simply calling code and
reduce the number of `unreachable!()`, `panic!()`, etcs.
A new `op_node_indices` is provided for ease for cases where the
iterator needs to be consumed to avoid being lifetime-tied to the DAG,
such as when the DAG is going to be mutated based on the nodes.
`topological_op_nodes` is left for a follow-up; it might be slightly
more challenging because of the interaction with rustworkx, but it can
also be done separately anyway.
0 commit comments