qiskit/transpiler/passes/mapping/enlarge_with_ancilla.py
def run(self, dag):
        """
        Extends dag with virtual qubits that are in layout but not in the circuit yet.

        Args:
            dag (DAGCircuit): DAG to extend.

        Returns:
            DAGCircuit: An extended DAG.

        Raises:
            TranspilerError: If there is not layout in the property set or not set at init time.
        """
        self.layout = self.layout or self.property_set['layout']

        if self.layout is None:
            raise TranspilerError("EnlargeWithAncilla requires property_set[\"layout\"] or"
                                  " \"layout\" parameter to run")

        layout_virtual_qubits = self.layout.get_virtual_bits().keys()
        new_qregs = set(virtual_qubit[0] for virtual_qubit in layout_virtual_qubits
                        if virtual_qubit not in dag.wires)

        for qreg in new_qregs:
            dag.add_qreg(qreg)

        return dag
def run(self, dag):
        self.layout = self.layout or self.property_set['layout']

        if self.layout is None:
            raise TranspilerError("EnlargeWithAncilla requires property_set[\"layout\"] or"
                                  " \"layout\" parameter to run")

        layout_virtual_qubits = self.layout.get_virtual_bits().keys()
        new_qregs = set(virtual_qubit[0] for virtual_qubit in layout_virtual_qubits
                        if virtual_qubit not in dag.wires)

        for qreg in new_qregs:
            dag.add_qreg(qreg)

        return dag
def run ( self , dag ) : self . layout = self . layout or self . property_set [ 'layout' ] if self . layout is None : raise TranspilerError ( "EnlargeWithAncilla requires property_set[\"layout\"] or" " \"layout\" parameter to run" ) layout_virtual_qubits = self . layout . get_virtual_bits ( ) . keys ( ) new_qregs = set ( virtual_qubit [ 0 ] for virtual_qubit in layout_virtual_qubits if virtual_qubit not in dag . wires ) for qreg in new_qregs : dag . add_qreg ( qreg ) return dag
Extends dag with virtual qubits that are in layout but not in the circuit yet.

        Args:
            dag (DAGCircuit): DAG to extend.

        Returns:
            DAGCircuit: An extended DAG.

        Raises:
            TranspilerError: If there is not layout in the property set or not set at init time.
Extends dag with virtual qubits that are in layout but not in the circuit yet .