Skip to content

Commit

Permalink
Rust side NLayout.copy()
Browse files Browse the repository at this point in the history
  • Loading branch information
mtreinish committed Aug 16, 2022
1 parent bbfc1c7 commit f07ba74
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion qiskit/transpiler/passes/routing/sabre_swap.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def run(self, dag):
self._bit_indices[k]: v for k, v in current_layout.get_virtual_bits().items()
}
layout = NLayout(layout_mapping, len(dag.qubits), self.coupling_map.size())
original_layout = NLayout(layout_mapping, len(dag.qubits), self.coupling_map.size())
original_layout = layout.copy()

dag_list = []
for node in dag.topological_op_nodes():
Expand Down
4 changes: 4 additions & 0 deletions src/nlayout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,8 @@ impl NLayout {
pub fn swap_physical(&mut self, bit_a: usize, bit_b: usize) {
self.swap(bit_a, bit_b)
}

pub fn copy(&self) -> NLayout {
self.clone()
}
}

0 comments on commit f07ba74

Please sign in to comment.