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 bug with auto-generated CNOT coherent error matrix in C++ simulator #318

Merged
merged 4 commits into from
Mar 5, 2018

Conversation

chriseclectic
Copy link
Member

This fixes a bug with auto generated coherent error matrices for CNOT gates in the C++ simulator backend.

Description

The matrix auto-generated from noise parameters "calibration_error" and "zz_error" was incorrect (one of the values was being put in the wrong matrix entry).

This removes this part of parsing the code from the C++, which now only accepts a matrix for the "U_error" noise parameter. The conversion of the noise parameters "calibration_error" (for CNOT and X90), "zz_error" (for CNOT) and "detuning_error" (for X90) into a "U_error" matrix is now done in Python.

I also fixed the old makefile for the simulator which was no longer compiling (@atilag this should be independent to building via cmake right?)

How Has This Been Tested?

I added some basic unit tests that the python generated coherent error matrices for the errors are correct.

For testing in the C++ code I added run-time test that the input matrix is unitary. If it is not unitary and the simulator will raise a runtime error which will be reported in the output json.

Types of changes

  • 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:

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

…ror matrices from cpp simulator to python code

- qiskit_simulator now only takes a U_error matrix
- parameters ‘calibration_error’, ‘detuning_error’, ‘zz_error’ for CX
and X90 gates are now converted to U_error matrices in python before
being passed to simulator
- fixed incorrect matrix used for CX calibration errors
- added check in C++ code that U_error is unitary
- added python unit tests to test U_error building matrices
- fixed directory change in makefile
@diego-plan9
Copy link
Member

Thanks, @chriseclectic ! Merging, will be included in the next release 👍

@diego-plan9 diego-plan9 merged commit c8f0440 into Qiskit:master Mar 5, 2018
@chriseclectic chriseclectic deleted the coherent-error-patch branch April 4, 2018 17:46
lia-approves pushed a commit to edasgupta/qiskit-terra that referenced this pull request Jul 30, 2019
…or (Qiskit#318)

* fixed bug in CX coherent error matrix and moved pre-build coherent error matrices from cpp simulator to python code

- qiskit_simulator now only takes a U_error matrix
- parameters ‘calibration_error’, ‘detuning_error’, ‘zz_error’ for CX
and X90 gates are now converted to U_error matrices in python before
being passed to simulator
- fixed incorrect matrix used for CX calibration errors
- added check in C++ code that U_error is unitary
- added python unit tests to test U_error building matrices
- fixed directory change in makefile

* updated backend strings in cpp_simulator ref files

* Fix linter warnings
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