Skip to content

Commit

Permalink
Rework short circuit logic
Browse files Browse the repository at this point in the history
  • Loading branch information
mtreinish committed Sep 6, 2024
1 parent 00153dd commit 7dee702
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions crates/accelerate/src/inverse_cancellation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,10 @@ pub fn inverse_cancellation(
inverse_gate_names: HashSet<String>,
self_inverse_gate_names: HashSet<String>,
) -> PyResult<()> {
let op_counts = if !self_inverse_gate_names.is_empty() || !inverse_gate_names.is_empty() {
dag.count_ops(py, true)?
} else {
IndexMap::default()
};
if self_inverse_gate_names.is_empty() && inverse_gate_names.is_empty() {
return Ok(());
}
let op_counts = dag.count_ops(py, true)?;
if !self_inverse_gate_names.is_empty() {
run_on_self_inverse(
py,
Expand Down

0 comments on commit 7dee702

Please sign in to comment.