Skip to content

Commit 8ec4c9c

Browse files
authored
Unify identifer handling of Var and Stretch in DAGCircuit (Qiskit#14000)
* s * Rename BitData to ObjectRegistry. * s * Update tests for new error string. This is only really a user-facing error message when working with DAGCircuit, since QuantumCircuit first checks if the bits being added to it are duplicates. And, in the case of DAGCircuit, the previous error message was already unfriendly: ValueError: Existing bit ShareableQubit(Owned { register: OwningRegisterInfo { name: "q16", size: 2, subclass: QUBIT }, index: 0 }) cannot be re-added in strict mode. * Fix comment in commutation checker. * Fix lint. * Address review comments. * Unify identifier handling in DAG. Tracks stretches the same way we track vars. Also happens to fix a bug in DAG equality where order mattered between stretch captures (it should never have). And, fixes a serialization bug with stretches. * Fix tests. * Improve testing and fix bug. * Add pickle and deepcopy tests for stretches. Also fix lint. * Undo breaking name change. * Add release note. * Fix lint. * Fix Python lint. * Address review comments.
1 parent 2dcc000 commit 8ec4c9c

File tree

6 files changed

+477
-280
lines changed

6 files changed

+477
-280
lines changed

crates/accelerate/src/commutation_checker.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ use qiskit_circuit::operations::OperationRef::{Gate as PyGateType, Operation as
3434
use qiskit_circuit::operations::{
3535
Operation, OperationRef, Param, StandardGate, STANDARD_GATE_SIZE,
3636
};
37-
use qiskit_circuit::{BitType, Clbit, Qubit};
37+
use qiskit_circuit::{Clbit, Qubit};
3838

3939
use crate::gate_metrics;
4040
use crate::unitary_compose;
@@ -98,8 +98,8 @@ static SUPPORTED_ROTATIONS: [Option<Option<StandardGate>>; STANDARD_GATE_SIZE] =
9898

9999
fn get_bits<T>(bits1: &Bound<PyTuple>, bits2: &Bound<PyTuple>) -> PyResult<(Vec<T>, Vec<T>)>
100100
where
101-
T: From<BitType> + Copy,
102-
BitType: From<T>,
101+
T: From<u32> + Copy,
102+
u32: From<T>,
103103
{
104104
// Using `PyObjectAsKey` here is a total hack, but this is a short-term workaround before a
105105
// larger refactor of the commutation checker.

0 commit comments

Comments
 (0)