Provide workaround for TwoQubitWeylDecomposition error for large circuits (backport #100)#125
Merged
Merged
Conversation
…uits (#100) * add transpilation of couple_qc * unit test * rename * Update to transpile onlyu if a QiskitError has been thrown * add release note for TwoQubitWeylDecomposition fix * Show warning by default * Tweak the release note * Update warning message to clarify that it is not an error * Update qiskit_addon_aqc_tensor/ansatz_generation/from_connectivity.py --------- Co-authored-by: Jim Garrison <garrison@ibm.com> Co-authored-by: Jim Garrison <jim@garrison.cc> (cherry picked from commit e926eed)
Pull Request Test Coverage Report for Build 18148242511Details
💛 - Coveralls |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi!
When using the
generate_ansatz_from_circuitfunction with a large circuit, I've encountered an error with Qiskit'sTwoQubitWeylDecomposition. See the below error message.This originates from the lines:
in
from_connectivity.py(304-305). You can recreate the error using:Many of the calls to
TwoQubitWeylDecompositionoccur without error, but for large circuits, there comes a point where one of the matrices fails to diagonalise. Interestingly, this is reproducible behaviour, and always occurs at the same point for a given circuit.This error has been mentioned in quite a few issues on GitHub/StackExchange (Qiskit/qiskit#4159, Qiskit/qiskit#14233, Qiskit/qiskit#7120, https://quantumcomputing.stackexchange.com/questions/41866/twoqubitweyldecomposition-failed-to-diagonalize-m2). I believe it usually arises when the matrix being decomposed is not unitary, however in all the cases I tested, the matrix was unitary to numerical precision (and returned
Operator(couple_qc).is_unitary() = True. It seems others have had this issue as well.I found a work-around by transpiling
couple_qcbefore passing it toTwoQubitWeylDecomposition. From playing around, it looks like the matrices produced byOperator(couple_qc).dataare identical to numerical precision before and after this transpilation, however one causes an error, and the other doesn't. I'm not sure exactly why this is the case, or if it works all the time, but it seems to work for the cases I looked into.This is an automatic backport of pull request #100 done by Mergify.