From bd962b3d454e202f480bec5a25d1e65a91037ddf Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Tue, 1 Oct 2024 07:15:07 -0400 Subject: [PATCH] Avoid checking if matrix is unitary in Split2qUnitaries (#13234) 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. --- crates/accelerate/src/split_2q_unitaries.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/accelerate/src/split_2q_unitaries.rs b/crates/accelerate/src/split_2q_unitaries.rs index b7bccf44232d..411571114bac 100644 --- a/crates/accelerate/src/split_2q_unitaries.rs +++ b/crates/accelerate/src/split_2q_unitaries.rs @@ -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 { if let Wire::Qubit(qubit) = edge { if *qubit == qubits[0] {