Skip to content

Commit

Permalink
remove _idle_wires function
Browse files Browse the repository at this point in the history
  • Loading branch information
ewinston committed Oct 4, 2022
1 parent d74b6ee commit 4dd68a9
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions qiskit/transpiler/passes/routing/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def route_cf_multiblock(tpass, cf_opnode, current_layout, qregs, root_dag, seed=
]
virtual_swap_dag.compose(physical_swap_dag, qubits=order)
updated_dag_block.compose(virtual_swap_dag)
idle_qubits[i] = _qubit_wires(updated_dag_block.idle_wires())
idle_qubits[i] = set(root_dag.qubits) & set(updated_dag_block.idle_wires())
cfop_idle_qubits = set.intersection(*map(set, idle_qubits))
# contract idle bits from full width post routing
for i, updated_dag_block in enumerate(block_dags):
Expand Down Expand Up @@ -149,7 +149,7 @@ def route_cf_looping(tpass, cf_opnode, current_layout, root_dag, seed=None):
virtual_swap_dag.compose(physical_swap_dag, qubits=order)
updated_dag_block.compose(virtual_swap_dag)
# contract from full width post routing
idle_qubits = _qubit_wires(updated_dag_block.idle_wires())
idle_qubits = set(root_dag.qubits) & set(updated_dag_block.idle_wires())
updated_dag_block.remove_qubits(*idle_qubits)
new_dag_block = DAGCircuit()
new_num_qubits = updated_dag_block.num_qubits()
Expand Down Expand Up @@ -179,18 +179,3 @@ def combine_permutations(*permutations):
for this_order in permutations[1:]:
order = [order[i] for i in this_order]
return order


def _qubit_wires(wires):
"""
Return list of Qubits from list of wires.
Args:
wires (list(Bit)): list of bits
Returns:
list(Qubit): returns qubit only wires
"""
from qiskit.circuit import Qubit

return [bit for bit in wires if isinstance(bit, Qubit)]

0 comments on commit 4dd68a9

Please sign in to comment.