From 18ad1aa3a0910787dccaa7cf1e227166cc7d0797 Mon Sep 17 00:00:00 2001 From: AlexanderIvrii Date: Mon, 8 Jul 2024 13:04:08 +0300 Subject: [PATCH] applying suggestions from code review --- crates/circuit/src/dag_circuit.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/crates/circuit/src/dag_circuit.rs b/crates/circuit/src/dag_circuit.rs index 7a869644415..7ad3a89f0ee 100644 --- a/crates/circuit/src/dag_circuit.rs +++ b/crates/circuit/src/dag_circuit.rs @@ -3201,8 +3201,9 @@ def _format(operand): } } - let elements : Vec<_> = qubits_in_cone.iter().map(|&qubit| qubit.0.into_py(py)).collect(); - Ok(PySet::new_bound(py, &elements)?.unbind()) + let qubits_in_cone_vec: Vec<_> = qubits_in_cone.iter().map(|&&qubit| qubit).collect(); + let elements = self.qubits.map_indices(&qubits_in_cone_vec[..]); + Ok(PySet::new_bound(py, elements)?.unbind()) } /// Return a dictionary of circuit properties. @@ -3286,7 +3287,7 @@ impl DAGCircuit { self.dag .edges_directed(node, Outgoing) .filter_map(|e| match e.weight() { - Wire::Qubit(_) => Some(e.source()), + Wire::Qubit(_) => Some(e.target()), _ => None, }) .unique()