Skip to content

Commit

Permalink
Make the output of the unitary synthesis pass reproducible
Browse files Browse the repository at this point in the history
  • Loading branch information
ElePT committed Jan 14, 2025
1 parent 321ce00 commit ec6a46b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions crates/accelerate/src/unitary_synthesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use std::sync::OnceLock;

use approx::relative_eq;
use hashbrown::{HashMap, HashSet};
use indexmap::IndexMap;
use indexmap::{IndexMap, IndexSet};
use itertools::Itertools;
use ndarray::prelude::*;
use num_complex::{Complex, Complex64};
Expand Down Expand Up @@ -627,8 +627,8 @@ fn get_2q_decomposers_from_target(
}

let target_basis_set = get_target_basis_set(target, qubits[0]);
let available_1q_basis: HashSet<&str> =
HashSet::from_iter(target_basis_set.get_bases().map(|basis| basis.as_str()));
let available_1q_basis: IndexSet<&str> =
IndexSet::from_iter(target_basis_set.get_bases().map(|basis| basis.as_str()));
let mut decomposers: Vec<DecomposerElement> = Vec::new();

#[inline]
Expand Down Expand Up @@ -689,10 +689,10 @@ fn get_2q_decomposers_from_target(
// If our 2q basis gates are a subset of cx, ecr, or cz then we know TwoQubitBasisDecomposer
// is an ideal decomposition and there is no need to bother calculating the XX embodiments
// or try the XX decomposer
let available_basis_set: HashSet<&str> = available_2q_basis.keys().copied().collect();
let available_basis_set: IndexSet<&str> = available_2q_basis.keys().copied().collect();

#[inline]
fn check_goodbye(basis_set: &HashSet<&str>) -> bool {
fn check_goodbye(basis_set: &IndexSet<&str>) -> bool {
basis_set.iter().all(|gate| GOODBYE_SET.contains(gate))
}

Expand Down

0 comments on commit ec6a46b

Please sign in to comment.