-
-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue #2354 Fix - qiskit QFT gates error during conversion #2404
Issue #2354 Fix - qiskit QFT gates error during conversion #2404
Conversation
…ns.py to decompose a qiskit circuit to native gates if an error occured. A test with zne was added to test for this with the QFT gate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @NnguyenHTommy, thank you for submitting a PR to Mitiq! We will respond as soon as possible, and if you have any questions in the meantime, you can ask us on the Unitary Fund Discord.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2404 +/- ##
==========================================
+ Coverage 98.30% 98.32% +0.01%
==========================================
Files 87 87
Lines 4003 4048 +45
==========================================
+ Hits 3935 3980 +45
Misses 68 68 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution, @NnguyenHTommy!
Good work so far. I left some comments, please take a look.
…s pull request. Moved the exception catch from the from_qiskit() to the from_qasm() function as that function is more general and is called by from_qiskit(). Used a QasmException catch instead of Exception to make it more clear that Qasm has trouble converting Adjusted code to follow the comments that cosenal placed with previous pull request. Moved the exception catch from the from_qiskit() to the from_qasm() function as that function is more general and is called by from_qiskit(). Used a QasmException catch instead of Exception to make it more clear that Qasm has trouble converting different gates. Removed choosing a basis for the transpile and let qiskit decide what gates to use. Added an additional test case to test the from_qasm() function.
@NnguyenHTommy Thanks for your second revision on this PR. I left some replies on the comments.. we are very close to merge this! |
…ption catch to the from_qiskit() function from the from_qasm() function as from_qasm() can handle non-qiskit circuits. Switched the test case to test the from_qiskit() function in doing so. Also only decomposed rather than transpiling and decomposing as transpiling doesn't do anything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Left some small nits.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
🎉 Thanks for your contribution @NnguyenHTommy, and congratulations on the UnitaryHack bounty!
If you had fun and want to learn more about Mitiq, come hang out on our Discord server.
* Fixed issue #2354 where a fallback was addded to conversions.py to decompose a qiskit circuit to native gates if an error occured. A test with zne was added to test for this with the QFT gate. * added myself to the bottom of the authors file * Adjusted code to follow the comments that cosenal placed with previous pull request. Moved the exception catch from the from_qiskit() to the from_qasm() function as that function is more general and is called by from_qiskit(). Used a QasmException catch instead of Exception to make it more clear that Qasm has trouble converting Adjusted code to follow the comments that cosenal placed with previous pull request. Moved the exception catch from the from_qiskit() to the from_qasm() function as that function is more general and is called by from_qiskit(). Used a QasmException catch instead of Exception to make it more clear that Qasm has trouble converting different gates. Removed choosing a basis for the transpile and let qiskit decide what gates to use. Added an additional test case to test the from_qasm() function. * resolving second round of changes reviewed by cosenal! moved the exception catch to the from_qiskit() function from the from_qasm() function as from_qasm() can handle non-qiskit circuits. Switched the test case to test the from_qiskit() function in doing so. Also only decomposed rather than transpiling and decomposing as transpiling doesn't do anything. * renaming and added updated docstrings according to cosenal suggestions
fixes issue #2354 where a QFT qiskit circuit would error out during conversion. Implemented a fallback mechanism to decompose and transpile the qiskit circuit into native gates. Added a unit test in the ZNE module to test this with qiskit's QFT gate.
This is my first open source contribution via unitary hack so any feedback would be appreciated!
Description
License
Before opening the PR, please ensure you have completed the following where appropriate.