Skip to content
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 mapper issue #342 #347

Merged
merged 4 commits into from
Mar 20, 2018
Merged

Fix mapper issue #342 #347

merged 4 commits into from
Mar 20, 2018

Conversation

ajavadia
Copy link
Member

The issue described in #342 is fixed (mapper bug alters already conforming circuits, and inserts operation after measurement).

This PR also resolves several other bug reports about mapper behavior:

Description

The default layout, if none is provided, is a layout of circuit qubit i to device qubit i. This is reasonable since many users will hand optimize circuits and create already-conforming gates, or would like to map qubits to exact same qubits on the device.

If compilation is being performed for a real backend, the compiler inserts barriers before measurements to ensure they do not move before gates.

Motivation and Context

How Has This Been Tested?

make test

Also added new tests in test_mapper.py and test_quantumprogram.py. So in the likely event of changing the mapper to another, faster code base, we will hopefully not encounter these issues.

Screenshots (if appropriate):

Types of changes

  • [ x] Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • [ x] My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • [ x] I have read the CONTRIBUTING document.
  • [ x] I have added tests to cover my changes.
  • [ x] All new and existing tests passed.

@ajavadia ajavadia changed the title Fixes mapper issue #342 Fix mapper issue #342 Mar 19, 2018
@diego-plan9
Copy link
Member

Wonderful, thanks @ajavadia for tackling the long-standing bug! I'm not closing the related issues yet (other than the one that will be automatically-closed when merging the PR) with the idea of officially going through them once the fix gets to the stable version, thanks for listing them! 👍

@diego-plan9 diego-plan9 merged commit a18ef48 into Qiskit:master Mar 20, 2018
@ajavadia ajavadia deleted the mapper-fix branch March 21, 2018 16:57
@ajavadia ajavadia mentioned this pull request Mar 24, 2018
lia-approves pushed a commit to edasgupta/qiskit-terra that referenced this pull request Jul 30, 2019
* get_qubits return in order

* added test to reproduce emoticon mapping issue

* test mapping of already-conforming circuits

* test gate after measure in quantumprogram
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants