- DAGCircuit.replace_block_with_op(node_block, op, wire_pos_map, cycle_check=True)¶
Replace a block of nodes with a single node.
This is used to consolidate a block of DAGOpNodes into a single operation. A typical example is a block of gates being consolidated into a single
UnitaryGaterepresenting the unitary matrix of the block.
node_block (List[DAGNode]) – A list of dag nodes that represents the node block to be replaced
op (qiskit.circuit.Operation) – The operation to replace the block with
wire_pos_map (Dict[Qubit, int]) – The dictionary mapping the qarg to the position. This is necessary to reconstruct the qarg order over multiple gates in the combined single op node.
cycle_check (bool) – When set to True this method will check that replacing the provided
node_blockwith a single node would introduce a cycle (which would invalidate the
DAGCircuit) and will raise a
DAGCircuitErrorif a cycle would be introduced. This checking comes with a run time penalty. If you can guarantee that your input
node_blockis a contiguous block and won’t introduce a cycle when it’s contracted to a single node, this can be set to
Falseto improve the runtime performance of this method.
DAGCircuitError – if
cycle_checkis set to
Trueand replacing the specified block introduces a cycle or if
The op node that replaces the block.
- Tipo de retorno