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 QuantumError sometimes casting probabilities to complex #640

Merged
merged 5 commits into from Feb 28, 2020
Merged

Fix QuantumError sometimes casting probabilities to complex #640

merged 5 commits into from Feb 28, 2020

Conversation

ghost
Copy link

@ghost ghost commented Feb 26, 2020

Summary

This PR is currently blocked by bugs in Aer. This PR will hopefully fix some of those bugs.

Details and comments

Currently, Noise Models are being received on the C++ side with probability attributes having (what appears to be) complex types - we have yet to identify why but the existing changes will at least raise a reasonable exception when it does happen.

Bug was caused by a missing cast from complex type to float type in a QuantumError factory. Thanks @chriseclectic

@ghost ghost requested review from atilag and chriseclectic as code owners February 26, 2020 16:18
@mtreinish
Copy link
Member

Thanks for starting this, the other thing which would probably be good here is to add a test case that runs something like:

from qiskit import execute
from qiskit import QuantumCircuit
from qiskit.test import mock
from qiskit.providers import aer
from qiskit.providers.aer.noise import NoiseModel

circ = QuantumCircuit(2)
circ.x(0)
circ.x(1)
circ.measure_all()

backend = mock.FakeSingapore()
noise_model = NoiseModel.from_backend(backend)
qobj = assemble(transpile(circ, backend), backend)
sim = aer.QasmSimulator()
sim.run(qobj, noise_model=noise_model).result()

to ensure we don't regress here moving forward.

@chriseclectic chriseclectic changed the title Enabling Mock backends with Noise Models in Terra Fix QuantumError sometimes casting probabilities to complex Feb 26, 2020
Copy link
Member

@mtreinish mtreinish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just one stray comment in there then I think we're good to merge this.

test/terra/noise/test_noise_model.py Outdated Show resolved Hide resolved
Copy link
Member

@mtreinish mtreinish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for updating

@chriseclectic chriseclectic merged commit d3ed41e into Qiskit:master Feb 28, 2020
mtreinish pushed a commit to mtreinish/qiskit-aer that referenced this pull request Mar 2, 2020
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