Skip to content
This repository has been archived by the owner on Dec 7, 2021. It is now read-only.

Setting is_measurement for converted state functions and backend arg required to CircuitSampler #1344

Merged
merged 26 commits into from
Oct 15, 2020

Conversation

molar-volume
Copy link
Contributor

Summary

resolves #1338
resolves #1339

Details and comments

  1. backend arg required to CircuitSampler
  2. setting is_measurement for converted state functions
  3. new test case in TestStateOpMeasEvals

@woodsp-ibm woodsp-ibm requested a review from jlapeyre October 14, 2020 00:04
@woodsp-ibm woodsp-ibm added the Changelog: Bugfix Include in the Fixed section of the changelog label Oct 15, 2020
Comment on lines 86 to 87
self.assertListEqual(sampler.eval(),
[[1.0, 0.6987712429686843], [0.7064159097160821, 1.0]])
Copy link
Contributor

Choose a reason for hiding this comment

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

Comparing to plain numbers is never a good idea 😉 Could you change this to just test if the first operand is still a measurement after going through the circuit sampler? Otherwise LGTM.

Copy link
Contributor Author

@molar-volume molar-volume Oct 15, 2020

Choose a reason for hiding this comment

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

But other tests in the module compare .eval() result to plain numbers.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Cryoris I changed the unit test in the way you suggested. Thanks for review.

Cryoris
Cryoris previously approved these changes Oct 15, 2020
Copy link
Contributor

@Cryoris Cryoris left a comment

Choose a reason for hiding this comment

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

Great, thanks for the fix!

woodsp-ibm
woodsp-ibm previously approved these changes Oct 15, 2020
@molar-volume molar-volume dismissed stale reviews from woodsp-ibm and Cryoris via 3e5819c October 15, 2020 16:13
@woodsp-ibm woodsp-ibm merged commit f8fae60 into qiskit-community:master Oct 15, 2020
@molar-volume molar-volume deleted the issue_1338 branch October 16, 2020 12:26
mtreinish pushed a commit to mtreinish/qiskit-core that referenced this pull request Nov 20, 2020
…required to CircuitSampler (qiskit-community/qiskit-aqua#1344)

* 1) backend arg required to CircuitSampler
2) setting is_measurement for converted state functions
3) new test case in TestStateOpMeasEvals

* test if is_measurement correctly propagated in CircuitSampler

* test_is_measurement_correctly_propagated simplified

* release note added

Co-authored-by: Steve Wood <40241007+woodsp-ibm@users.noreply.github.com>
Co-authored-by: Julien Gacon <gaconju@gmail.com>
manoelmarques pushed a commit to manoelmarques/qiskit-terra that referenced this pull request Dec 2, 2020
…required to CircuitSampler (qiskit-community/qiskit-aqua#1344)

* 1) backend arg required to CircuitSampler
2) setting is_measurement for converted state functions
3) new test case in TestStateOpMeasEvals

* test if is_measurement correctly propagated in CircuitSampler

* test_is_measurement_correctly_propagated simplified

* release note added

Co-authored-by: Steve Wood <40241007+woodsp-ibm@users.noreply.github.com>
Co-authored-by: Julien Gacon <gaconju@gmail.com>
manoelmarques pushed a commit to manoelmarques/qiskit-terra that referenced this pull request Dec 7, 2020
…required to CircuitSampler (qiskit-community/qiskit-aqua#1344)

* 1) backend arg required to CircuitSampler
2) setting is_measurement for converted state functions
3) new test case in TestStateOpMeasEvals

* test if is_measurement correctly propagated in CircuitSampler

* test_is_measurement_correctly_propagated simplified

* release note added

Co-authored-by: Steve Wood <40241007+woodsp-ibm@users.noreply.github.com>
Co-authored-by: Julien Gacon <gaconju@gmail.com>
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
Changelog: Bugfix Include in the Fixed section of the changelog
Projects
None yet
3 participants