Skip to content

Commit

Permalink
Fix: Adapt to rebase
Browse files Browse the repository at this point in the history
- io-maps are Vecs now, this commit fixes their behavior.
  • Loading branch information
raynelfss committed Aug 23, 2024
1 parent f0ee316 commit 432397e
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions crates/circuit/src/dag_circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6290,7 +6290,7 @@ impl DAGCircuit {
let qubit_last_node = if let Some((node, wire)) = qubit_last_nodes.remove(qubit) {
(node, wire)
} else {
let output_node = self.qubit_io_map[qubit][1];
let output_node = self.qubit_io_map[qubit.0 as usize][1];
let (edge_id, predecessor_node) = self
.dag
.edges_directed(output_node, Incoming)
Expand All @@ -6311,7 +6311,7 @@ impl DAGCircuit {
let clbit_last_node = if let Some((node, wire)) = clbit_last_nodes.remove(&clbit) {
(node, wire)
} else {
let output_node = self.clbit_io_map[&clbit][1];
let output_node = self.clbit_io_map[clbit.0 as usize][1];
let (edge_id, predecessor_node) = self
.dag
.edges_directed(output_node, Incoming)
Expand Down Expand Up @@ -6361,13 +6361,13 @@ impl DAGCircuit {

// Add the output_nodes back to qargs
for (qubit, (node, wire)) in qubit_last_nodes {
let output_node = self.qubit_io_map[&qubit][1];
let output_node = self.qubit_io_map[qubit.0 as usize][1];
self.dag.add_edge(node, output_node, wire);
}

// Add the output_nodes back to cargs
for (clbit, (node, wire)) in clbit_last_nodes {
let output_node = self.clbit_io_map[&clbit][1];
let output_node = self.clbit_io_map[clbit.0 as usize][1];
self.dag.add_edge(node, output_node, wire);
}

Expand Down Expand Up @@ -6462,8 +6462,9 @@ impl DAGCircuit {
py,
clbit_data
.bits()
.to_object(py)
.downcast_bound::<PySequence>(py)?,
.iter()
.map(|bit| bit.clone_ref(py).into_bound(py))
.collect(),
)?;

// Finally, add all the valid instructions to the DAGCircuit.
Expand Down

0 comments on commit 432397e

Please sign in to comment.