-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Fix #674: Measurements before swap mapping #691
Conversation
This keeps failing on Travis, but works perfectly on my machine. Don't know why. |
I have tested on Py35 as well, and it always works. Not sure why it fails on Travis. |
I have also run this on a Ubuntu VM and it passes all tests. @diego-plan9 @atilag @delapuente do you know why this PR would be failing a test in the lint and pure python stage, but working fine when run locally? |
As discovered with @diego-plan9, the problem was |
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 @nonhermitian - neat fix! I added an entry to the changelog as it has enough importance to include it, and merging!
* Fix Qiskit#674 * Test for Qiskit#674 * Forgot test_mapper.py * add initial layout to test * Update changelog
Summary
In order to satisfy the requirements of a restricted coupling map, the
swap_mapper
might need to swap into qubits that were measured.Details and comments
Here we remove the measurements that have no gates after them, i.e. they are at the end of the circuit, before performing the swap mapping. Once the mapping is done, the measurements are added to the end of the circuit. A test that verifies the solution for a known problem circuit is provided.
The functionality added here also gives a clean way of solving #666, but requires adding a flag to the
Qobj
and having the simulator read the flag. That will done done in another PR.