Skip to content

Commit

Permalink
Avoid checking if matrix is unitary in Split2qUnitaries
Browse files Browse the repository at this point in the history
This commit fixes a small oversight in the Split2QUnitaries transpiler
pass. When it does decide to split the unitary into two single qubit
unitary gates it was creating a new UnitaryGate object. When these
UnitaryGate objects were created we weren't setting the check_input flag
to false. This meant we were spending time validating the matrix was a
unitary, but in the context the matrix is known to be unitary already,
so we don't need to spend the time doing this checking.
  • Loading branch information
mtreinish committed Sep 27, 2024
1 parent 1686815 commit d7ab680
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions crates/accelerate/src/split_2q_unitaries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,12 @@ pub fn split_2q_unitaries(
if matches!(decomp.specialization, Specialization::IdEquiv) {
let k1r_arr = decomp.K1r(py);
let k1l_arr = decomp.K1l(py);
let k1r_gate = UNITARY_GATE.get_bound(py).call1((k1r_arr,))?;
let k1l_gate = UNITARY_GATE.get_bound(py).call1((k1l_arr,))?;
let k1r_gate = UNITARY_GATE
.get_bound(py)
.call1((k1r_arr, py.None(), false))?;
let k1l_gate = UNITARY_GATE
.get_bound(py)
.call1((k1l_arr, py.None(), false))?;
let insert_fn = |edge: &Wire| -> PyResult<OperationFromPython> {
if let Wire::Qubit(qubit) = edge {
if *qubit == qubits[0] {
Expand Down

0 comments on commit d7ab680

Please sign in to comment.