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 of eval_observables() when quantum_circuit is a StateFn. #7863

Merged
merged 5 commits into from
Apr 4, 2022

Conversation

Anthony-Gandon
Copy link
Contributor

Summary

StateFn(StateFn()) actually returns an OperatorStateFn.
This caused an error in _prepare_list_op that was not checked by the test cases in test_aux_ops_evaluator.py.
The associated test case was added.

Previous error message:

qiskit.opflow.exceptions.OpflowError: 
'Circuits are empty. Check that the operator is an instance of CircuitStateFn or its ListOp.'

StateFn(StateFn()) actually returns an OperatorStateFn.
This caused an issue that was not checked by the
test cases test_aux_ops_evaluator.py.

The associated test case was added.
@Cryoris Cryoris modified the milestones: 0.21, 0.20.1 Apr 2, 2022
@Cryoris Cryoris added the Changelog: Bugfix Include in the "Fixed" section of the changelog label Apr 2, 2022
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.

One small comment on the release note, otherwise LGTM!

@Cryoris Cryoris added the stable backport potential The bug might be minimal and/or import enough to be port to stable label Apr 2, 2022
@coveralls
Copy link

coveralls commented Apr 2, 2022

Pull Request Test Coverage Report for Build 2090306568

  • 3 of 3 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.0003%) to 83.725%

Totals Coverage Status
Change from base Build 2090303759: 0.0003%
Covered Lines: 53997
Relevant Lines: 64493

💛 - Coveralls

Co-authored-by: Julien Gacon <gaconju@gmail.com>
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.

LGTM, thanks for the fix!

@mergify mergify bot merged commit a296ca0 into Qiskit:main Apr 4, 2022
mergify bot pushed a commit that referenced this pull request Apr 4, 2022
* Fix the eval_observables() when quantum_state is StateFn.

StateFn(StateFn()) actually returns an OperatorStateFn.
This caused an issue that was not checked by the
test cases test_aux_ops_evaluator.py.

The associated test case was added.

* Add the associated releasenote

* Update releasenotes/notes/fix-aux-ops-evaluator-83ce1606d1ad19b3.yaml

Co-authored-by: Julien Gacon <gaconju@gmail.com>

* Fix sphinx identifier

Co-authored-by: Julien Gacon <gaconju@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
(cherry picked from commit a296ca0)
mergify bot added a commit that referenced this pull request Apr 4, 2022
…7881)

* Fix the eval_observables() when quantum_state is StateFn.

StateFn(StateFn()) actually returns an OperatorStateFn.
This caused an issue that was not checked by the
test cases test_aux_ops_evaluator.py.

The associated test case was added.

* Add the associated releasenote

* Update releasenotes/notes/fix-aux-ops-evaluator-83ce1606d1ad19b3.yaml

Co-authored-by: Julien Gacon <gaconju@gmail.com>

* Fix sphinx identifier

Co-authored-by: Julien Gacon <gaconju@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
(cherry picked from commit a296ca0)

Co-authored-by: Anthony-Gandon <antho91370@gmail.com>
ElePT pushed a commit to ElePT/qiskit that referenced this pull request Jun 27, 2023
…7863)

* Fix the eval_observables() when quantum_state is StateFn.

StateFn(StateFn()) actually returns an OperatorStateFn.
This caused an issue that was not checked by the
test cases test_aux_ops_evaluator.py.

The associated test case was added.

* Add the associated releasenote

* Update releasenotes/notes/fix-aux-ops-evaluator-83ce1606d1ad19b3.yaml

Co-authored-by: Julien Gacon <gaconju@gmail.com>

* Fix sphinx identifier

Co-authored-by: Julien Gacon <gaconju@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
ElePT pushed a commit to ElePT/qiskit-algorithms-test that referenced this pull request Jul 17, 2023
…qiskit#7863)

* Fix the eval_observables() when quantum_state is StateFn.

StateFn(StateFn()) actually returns an OperatorStateFn.
This caused an issue that was not checked by the
test cases test_aux_ops_evaluator.py.

The associated test case was added.

* Add the associated releasenote

* Update releasenotes/notes/fix-aux-ops-evaluator-83ce1606d1ad19b3.yaml

Co-authored-by: Julien Gacon <gaconju@gmail.com>

* Fix sphinx identifier

Co-authored-by: Julien Gacon <gaconju@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: Bugfix Include in the "Fixed" section of the changelog stable backport potential The bug might be minimal and/or import enough to be port to stable
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants