Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix UnitarySynthesis with target that contains custom gates (Qiskit#9677
) * Fix UnitarySynthesis with target that contains custom gates Since Qiskit#9175 merged the UnitarySynthesis pass has been updated to consider multiple different potential target bases and select the best performing synthesis output found. When UnitarySynthesis is provided a Target object this involves querying the target for the error rates and duration of the instructions used and determining which bases are valid. As part of this lookup the Operator for the 2q gates in the target is needed to determine the characteristics of the 2q gates. However, the code for doing this wasn't considering that some operations in the target might not have sufficient information to build a unitary representation of the operation. This could come up with the use of custom opaque gates in the target that don't have a definition defined or a matrix defined. This commit fixes this oversight and handles the case where building an Operator for the gate fails. Related to #9675 (the underlying issue is in the qiskit-ibm-runtime package for not mapping the "ecr" string to the "ECRGate" object, so this won't close that issue). * Fix lint * Only run Operator construction under try block The error we're trying to catch and handle is if a gate object doesn't have sufficient information to get it's matrix. This commit updates the try block to only run on the Operator construction so we don't potentially mas errors in the TwoQubitWeylDecomposition construction. --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
- Loading branch information