qiskit/transpiler/passes/consolidate_blocks.py
def _block_qargs_to_indices(self, block_qargs, global_index_map):
        """
        Map each qubit in block_qargs to its wire position among the block's wires.
        Args:
            block_qargs (list): list of qubits that a block acts on
            global_index_map (dict): mapping from each qubit in the
                circuit to its wire position within that circuit
        Returns:
            dict: mapping from qarg to position in block
        """
        block_indices = [global_index_map[q] for q in block_qargs]
        ordered_block_indices = sorted(block_indices)
        block_positions = {q: ordered_block_indices.index(global_index_map[q])
                           for q in block_qargs}
        return block_positions
def _block_qargs_to_indices(self, block_qargs, global_index_map):
        """
        Map each qubit in block_qargs to its wire position among the block's wires.
        Args:
            block_qargs (list): list of qubits that a block acts on
            global_index_map (dict): mapping from each qubit in the
                circuit to its wire position within that circuit
        Returns:
            dict: mapping from qarg to position in block
        """
        block_indices = [global_index_map[q] for q in block_qargs]
        ordered_block_indices = sorted(block_indices)
        block_positions = {q: ordered_block_indices.index(global_index_map[q])
                           for q in block_qargs}
        return block_positions
def _block_qargs_to_indices ( self , block_qargs , global_index_map ) : block_indices = [ global_index_map [ q ] for q in block_qargs ] ordered_block_indices = sorted ( block_indices ) block_positions = { q : ordered_block_indices . index ( global_index_map [ q ] ) for q in block_qargs } return block_positions
Map each qubit in block_qargs to its wire position among the block's wires.
        Args:
            block_qargs (list): list of qubits that a block acts on
            global_index_map (dict): mapping from each qubit in the
                circuit to its wire position within that circuit
        Returns:
            dict: mapping from qarg to position in block
Map each qubit in block_qargs to its wire position among the block s wires . Args : block_qargs ( list ) : list of qubits that a block acts on global_index_map ( dict ) : mapping from each qubit in the circuit to its wire position within that circuit Returns : dict : mapping from qarg to position in block