Skip to content

Commit

Permalink
Merge 2289b4c into ea5a54b
Browse files Browse the repository at this point in the history
  • Loading branch information
mtreinish committed Jun 28, 2024
2 parents ea5a54b + 2289b4c commit 082ade6
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 13 deletions.
2 changes: 1 addition & 1 deletion crates/accelerate/src/dense_layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ pub fn best_subset_inner(
SubsetResult {
count: 0,
map: Vec::new(),
error: std::f64::INFINITY,
error: f64::INFINITY,
subgraph: Vec::new(),
}
};
Expand Down
6 changes: 3 additions & 3 deletions crates/accelerate/src/nlayout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ impl NLayout {
physical_qubits: usize,
) -> Self {
let mut res = NLayout {
virt_to_phys: vec![PhysicalQubit(std::u32::MAX); virtual_qubits],
phys_to_virt: vec![VirtualQubit(std::u32::MAX); physical_qubits],
virt_to_phys: vec![PhysicalQubit(u32::MAX); virtual_qubits],
phys_to_virt: vec![VirtualQubit(u32::MAX); physical_qubits],
};
for (virt, phys) in qubit_indices {
res.virt_to_phys[virt.index()] = phys;
Expand Down Expand Up @@ -184,7 +184,7 @@ impl NLayout {

#[staticmethod]
pub fn from_virtual_to_physical(virt_to_phys: Vec<PhysicalQubit>) -> PyResult<Self> {
let mut phys_to_virt = vec![VirtualQubit(std::u32::MAX); virt_to_phys.len()];
let mut phys_to_virt = vec![VirtualQubit(u32::MAX); virt_to_phys.len()];
for (virt, phys) in virt_to_phys.iter().enumerate() {
phys_to_virt[phys.index()] = VirtualQubit(virt.try_into()?);
}
Expand Down
10 changes: 5 additions & 5 deletions crates/accelerate/src/stochastic_swap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@ fn swap_trial(
let mut new_cost: f64;
let mut dist: f64;

let mut optimal_start = PhysicalQubit::new(std::u32::MAX);
let mut optimal_end = PhysicalQubit::new(std::u32::MAX);
let mut optimal_start_qubit = VirtualQubit::new(std::u32::MAX);
let mut optimal_end_qubit = VirtualQubit::new(std::u32::MAX);
let mut optimal_start = PhysicalQubit::new(u32::MAX);
let mut optimal_end = PhysicalQubit::new(u32::MAX);
let mut optimal_start_qubit = VirtualQubit::new(u32::MAX);
let mut optimal_end_qubit = VirtualQubit::new(u32::MAX);

let mut scale = Array2::zeros((num_qubits, num_qubits));

Expand Down Expand Up @@ -270,7 +270,7 @@ pub fn swap_trials(
// unless force threads is set.
let run_in_parallel = getenv_use_multiple_threads();

let mut best_depth = std::usize::MAX;
let mut best_depth = usize::MAX;
let mut best_edges: Option<EdgeCollection> = None;
let mut best_layout: Option<NLayout> = None;
if run_in_parallel {
Expand Down
5 changes: 1 addition & 4 deletions crates/circuit/src/circuit_instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -825,10 +825,7 @@ pub(crate) fn convert_py_to_operation_type(
};
let op_type: Bound<PyType> = raw_op_type.into_bound(py);
let mut standard: Option<StandardGate> = match op_type.getattr(attr) {
Ok(stdgate) => match stdgate.extract().ok() {
Some(gate) => gate,
None => None,
},
Ok(stdgate) => stdgate.extract().ok().unwrap_or_default(),
Err(_) => None,
};
// If the input instruction is a standard gate and a singleton instance
Expand Down

0 comments on commit 082ade6

Please sign in to comment.