Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ rustworkx-core = "0.17"
fixedbitset = "0.5.7"
approx = "0.5"
itertools = "0.14.0"
ahash = "0.8.12"
foldhash = "0.2.0"
rayon = "1.12"
nom = "8.0"
nom-unicode = "0.4"
Expand Down
2 changes: 1 addition & 1 deletion crates/cext/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ qiskit-circuit-library.workspace = true
qiskit-transpiler.workspace = true
pyo3 = { workspace = true, optional = true }
indexmap.workspace = true
ahash.workspace = true
foldhash.workspace = true
smallvec.workspace = true
ndarray.workspace = true
nalgebra.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/cext/src/transpiler/target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ impl From<StandardOperation> for PackedOperation {
pub struct TargetEntry {
operation: StandardOperation,
params: Option<SmallVec<[Param; 3]>>,
map: IndexMap<Qargs, Option<InstructionProperties>, ahash::RandomState>,
map: IndexMap<Qargs, Option<InstructionProperties>, foldhash::fast::RandomState>,
name: Option<String>,
}

Expand Down
3 changes: 2 additions & 1 deletion crates/circuit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ workspace = true
qiskit-util = { workspace = true, features = ["py"] }
qiskit-quantum-info.workspace = true
rayon.workspace = true
ahash.workspace = true
foldhash.workspace = true
rustworkx-core.workspace = true
bytemuck = {workspace = true, features = ["derive"]}
bitfield-struct.workspace = true
Expand All @@ -32,6 +32,7 @@ nom-unicode.workspace = true
nom-language.workspace = true
crossterm = "0.29.0"
unicode-width = "0.2"
ahash = "0.8.12"
unicode-segmentation = "1.13"

[dependencies.pyo3]
Expand Down
2 changes: 1 addition & 1 deletion crates/circuit/src/bit_locator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use pyo3::types::{IntoPyDict, PyDict};
/// the circuit.
#[derive(Debug)]
pub struct BitLocator<B, R: Register> {
bit_locations: IndexMap<B, BitLocations<R>, ::ahash::RandomState>,
bit_locations: IndexMap<B, BitLocations<R>, ::foldhash::fast::RandomState>,
cached: OnceLock<Py<PyDict>>,
}

Expand Down
7 changes: 4 additions & 3 deletions crates/circuit/src/circuit_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1751,8 +1751,9 @@ impl CircuitData {
///
/// # Returns
/// An IndexMap containing the operation names as keys and their respective counts as values.
pub fn count_ops(&self) -> IndexMap<&str, usize, ::ahash::RandomState> {
let mut ops_count: IndexMap<&str, usize, ::ahash::RandomState> = IndexMap::default();
pub fn count_ops(&self) -> IndexMap<&str, usize, ::foldhash::fast::RandomState> {
let mut ops_count: IndexMap<&str, usize, ::foldhash::fast::RandomState> =
IndexMap::default();
for instruction in &self.data {
*ops_count.entry(instruction.op.name()).or_insert(0) += 1;
}
Expand Down Expand Up @@ -2897,7 +2898,7 @@ impl PyCircuitData {
///
/// # Returns
/// An IndexMap containing the operation names as keys and their respective counts as values.
pub fn count_ops(&self) -> IndexMap<&str, usize, ::ahash::RandomState> {
pub fn count_ops(&self) -> IndexMap<&str, usize, ::foldhash::fast::RandomState> {
self.inner.count_ops()
}

Expand Down
10 changes: 5 additions & 5 deletions crates/circuit/src/dag_circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use std::cmp::Ordering;
use std::hash::Hash;
use std::sync::Arc;

use ahash::RandomState;
use foldhash::fast::RandomState;
use smallvec::SmallVec;

use crate::bit::{
Expand Down Expand Up @@ -672,13 +672,13 @@ impl DAGCircuit {
RegisterData::from_mapping(dict_state.get_item("qregs")?.unwrap().extract::<IndexMap<
String,
QuantumRegister,
::ahash::RandomState,
::foldhash::fast::RandomState,
>>()?);
self.cregs =
RegisterData::from_mapping(dict_state.get_item("cregs")?.unwrap().extract::<IndexMap<
String,
ClassicalRegister,
::ahash::RandomState,
::foldhash::fast::RandomState,
>>()?);
self.global_phase = dict_state.get_item("global_phase")?.unwrap().extract()?;
self.op_names = dict_state.get_item("op_name")?.unwrap().extract()?;
Expand Down Expand Up @@ -5813,7 +5813,7 @@ impl DAGCircuit {
};
// Put the new node in-between the previously "last" nodes on each wire
// and the terminal map.
let termini: IndexSet<NodeIndex, ::ahash::RandomState> = self
let termini: IndexSet<NodeIndex, ::foldhash::fast::RandomState> = self
.qargs_interner
.get(qubits_id)
.iter()
Expand Down Expand Up @@ -5869,7 +5869,7 @@ impl DAGCircuit {
) -> PyResult<(Vec<Clbit>, Option<Vec<Var>>)> {
let (all_clbits, vars): (Vec<Clbit>, Option<Vec<Var>>) = {
if self.may_have_additional_wires(instr) {
let mut clbits: IndexSet<Clbit, ::ahash::RandomState> =
let mut clbits: IndexSet<Clbit, ::foldhash::fast::RandomState> =
IndexSet::from_iter(self.cargs_interner.get(instr.clbits).iter().copied());
let (additional_clbits, additional_vars) =
Python::attach(|py| self.additional_wires(py, instr))?;
Expand Down
7 changes: 5 additions & 2 deletions crates/circuit/src/interner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,9 @@ mod interned_map {
/// assert_eq!(interner.get(key), &[0, 1, 2, 3, 4]);
/// ```
#[derive(Default)]
pub struct Interner<T: ?Sized + ToOwned>(IndexSet<<T as ToOwned>::Owned, ::ahash::RandomState>);
pub struct Interner<T: ?Sized + ToOwned>(
IndexSet<<T as ToOwned>::Owned, ::foldhash::fast::RandomState>,
);

// `Clone` and `Debug` can't use the derivation mechanism because the values that are actually
// stored are of type `<T as ToOwned>::Owned`, which the derive system doesn't reason about.
Expand Down Expand Up @@ -286,7 +288,8 @@ where
/// Note that the default item of the interner is always allocated and given a key immediately,
/// which will use one slot of the capacity.
pub fn with_capacity(capacity: usize) -> Self {
let mut set = IndexSet::with_capacity_and_hasher(capacity, ::ahash::RandomState::new());
let mut set =
IndexSet::with_capacity_and_hasher(capacity, ::foldhash::fast::RandomState::default());
set.insert(Default::default());
Self(set)
}
Expand Down
5 changes: 3 additions & 2 deletions crates/circuit/src/parameter/parameter_expression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ impl fmt::Display for ParameterExpression {
impl ParameterExpression {
pub fn qpy_replay(&self) -> Vec<OPReplay> {
let mut replay = Vec::new();
let mut unused: IndexSet<_, ahash::RandomState> = self.name_map.values().cloned().collect();
let mut unused: IndexSet<_, foldhash::fast::RandomState> =
self.name_map.values().cloned().collect();
// The recursive inner `qpy_replay_inner` assumes it starts from a containing operation, so
// fails to build a complete replay in the case it starts from a single symbol or value.
match &self.expr {
Expand Down Expand Up @@ -2077,7 +2078,7 @@ fn qpy_replay_inner(
expr: &ParameterExpression,
name_map: &HashMap<String, Symbol>,
replay: &mut Vec<OPReplay>,
unused: &mut IndexSet<Symbol, ahash::RandomState>,
unused: &mut IndexSet<Symbol, foldhash::fast::RandomState>,
) {
match &expr.expr {
// This function is written under the assumption that the top-level expression involves an
Expand Down
6 changes: 3 additions & 3 deletions crates/circuit/src/vf2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,7 @@ where
{
type Item = Result<
(
IndexMap<N::NodeId, H::NodeId, ::ahash::RandomState>,
IndexMap<N::NodeId, H::NodeId, ::foldhash::fast::RandomState>,
NS::Score,
),
IsIsomorphicError<NS::Error, ES::Error>,
Expand Down Expand Up @@ -1250,7 +1250,7 @@ where
NS: Semantics<N::NodeWeight, H::NodeWeight>,
ES: Semantics<N::EdgeWeight, H::EdgeWeight, Score = NS::Score>,
{
fn mapping(&self) -> IndexMap<NId, HId, ::ahash::RandomState> {
fn mapping(&self) -> IndexMap<NId, HId, ::foldhash::fast::RandomState> {
self.needle
.mapping
.iter()
Expand Down Expand Up @@ -1824,7 +1824,7 @@ where
ES: Semantics<N::EdgeWeight, H::EdgeWeight, Score = NS::Score>,
{
type Item = Result<
(IndexMap<NId, HId, ::ahash::RandomState>, NS::Score),
(IndexMap<NId, HId, ::foldhash::fast::RandomState>, NS::Score),
IsIsomorphicError<NS::Error, ES::Error>,
>;

Expand Down
2 changes: 1 addition & 1 deletion crates/qasm3/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ hashbrown.workspace = true
oq3_semantics = "0.7.0"
oq3_syntax = "0.7.0"
qiskit-circuit.workspace = true
ahash.workspace = true
foldhash.workspace = true
regex = "1.12"
lazy_static = "1.5"
thiserror.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/qasm3/src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
use pyo3::prelude::*;
use pyo3::types::{PySequence, PyTuple};

use ahash::RandomState;
use foldhash::fast::RandomState;

use hashbrown::HashMap;
use indexmap::IndexMap;
Expand Down
2 changes: 1 addition & 1 deletion crates/qpy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ workspace = true
indexmap.workspace = true
hashbrown.workspace = true
oq3_semantics = "0.7.0"
ahash.workspace = true
foldhash.workspace = true
qiskit-circuit.workspace = true
qiskit-quantum-info.workspace = true
num-bigint.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/quantum_info/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ rustworkx-core.workspace = true
thiserror.workspace = true
rayon.workspace = true
bytemuck.workspace = true
ahash.workspace = true
foldhash.workspace = true
ndarray-einsum = "0.8.0"
rand.workspace = true
rand_pcg.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/quantum_info/src/sparse_observable/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3662,7 +3662,7 @@ impl PySparseObservable {
let order = order
.try_iter()?
.map(|obj| obj.and_then(|obj| obj.extract::<u32>()))
.collect::<PyResult<IndexSet<u32, ::ahash::RandomState>>>()?;
.collect::<PyResult<IndexSet<u32, ::foldhash::fast::RandomState>>>()?;
if order.len() != in_length {
return Err(PyValueError::new_err("duplicate indices in qargs"));
}
Expand Down
4 changes: 2 additions & 2 deletions crates/quantum_info/src/sparse_pauli_op.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// copyright notice, and modified files need to carry a notice indicating
// that they have been altered from the originals.

use ahash::RandomState;
use foldhash::fast::RandomState;
use pyo3::Python;
use pyo3::exceptions::{PyRuntimeError, PyValueError};
use pyo3::prelude::*;
Expand Down Expand Up @@ -337,7 +337,7 @@ impl MatrixCompressedPaulis {
let mut hash_table =
IndexMap::<(u64, u64), Complex64, RandomState>::with_capacity_and_hasher(
self.coeffs.len(),
RandomState::new(),
RandomState::default(),
);
for (key, coeff) in self
.x_like
Expand Down
2 changes: 1 addition & 1 deletion crates/synthesis/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ qiskit-util.workspace = true
bytemuck.workspace = true
num-complex.workspace = true
nalgebra.workspace = true
ahash.workspace = true
foldhash.workspace = true
itertools.workspace = true
numpy.workspace = true
rayon.workspace = true
Expand Down
10 changes: 5 additions & 5 deletions crates/synthesis/src/clifford/greedy_synthesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// copyright notice, and modified files need to carry a notice indicating
// that they have been altered from the originals.

use ahash::RandomState;
use foldhash::fast::RandomState;
use indexmap::IndexSet;
use ndarray::{Array2, ArrayView2, s};
use smallvec::smallvec;
Expand Down Expand Up @@ -198,10 +198,10 @@ impl GreedyCliffordSynthesis<'_> {
gate_seq: &mut CliffordGatesVec,
min_qubit: usize,
) -> Result<(), String> {
let mut a_qubits: IndexSet<_, ::ahash::RandomState> = IndexSet::default();
let mut b_qubits: IndexSet<_, ::ahash::RandomState> = IndexSet::default();
let mut c_qubits: IndexSet<_, ::ahash::RandomState> = IndexSet::default();
let mut d_qubits: IndexSet<_, ::ahash::RandomState> = IndexSet::default();
let mut a_qubits: IndexSet<_, ::foldhash::fast::RandomState> = IndexSet::default();
let mut b_qubits: IndexSet<_, ::foldhash::fast::RandomState> = IndexSet::default();
let mut c_qubits: IndexSet<_, ::foldhash::fast::RandomState> = IndexSet::default();
let mut d_qubits: IndexSet<_, ::foldhash::fast::RandomState> = IndexSet::default();

for qubit in &self.unprocessed_qubits {
let pauli_pair_index = pauli_pair_to_index(
Expand Down
2 changes: 1 addition & 1 deletion crates/transpiler/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ workspace = true
rayon.workspace = true
rayon-cond = "0.4.0"
numpy.workspace = true
ahash.workspace = true
foldhash.workspace = true
itertools.workspace = true
nalgebra.workspace = true
rand.workspace = true
Expand Down
Loading