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

Local fidelity #9504

Merged
merged 9 commits into from
Feb 1, 2023
Merged

Local fidelity #9504

merged 9 commits into from
Feb 1, 2023

Conversation

gentinettagian
Copy link
Contributor

Summary

Adds a flag average_local to the ComputeUncompute state fidelity class that allows to compute the local fidelity, which is defined by averaging over single-qubit projectors. It has been shown that global observables, such as the global projector used in the standard fidelity, lead to cost-function induced barren plateaus that can be mitigated by employing a local cost-function instead [1].

While this local fidelity cannot replace the global fidelity in all use cases, it coincides with the global version in the case that the fidelity is 1. This is especially useful in algorithms where the fidelity is maximised variationally, such as for example in p-VQD.

Details and Comments

I added a unit test for the case where the fidelity is 1. Open for suggestions for further unit tests if anyone has an idea of an example that would make sense.

References

[1] Cerezo, M., Sone, A., Volkoff, T. et al. Cost function dependent barren plateaus in shallow parametrized quantum circuits. Nat Commun 12, 1791 (2021). https://doi.org/10.1038/s41467-021-21728-w

@qiskit-bot qiskit-bot added the Community PR PRs from contributors that are not 'members' of the Qiskit repo label Feb 1, 2023
@qiskit-bot
Copy link
Collaborator

Thank you for opening a new pull request.

Before your PR can be merged it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient.

While you're waiting, please feel free to review other open PRs. While only a subset of people are authorized to approve pull requests for merging, everyone is encouraged to review open pull requests. Doing reviews helps reduce the burden on the core team and helps make the project's code better for everyone.

One or more of the the following people are requested to review this:

@gentinettagian
Copy link
Contributor Author

@Cryoris maybe you have some further suggestions?

@coveralls
Copy link

coveralls commented Feb 1, 2023

Pull Request Test Coverage Report for Build 4067143317

  • 14 of 14 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 85.245%

Totals Coverage Status
Change from base Build 4067142287: 0%
Covered Lines: 67108
Relevant Lines: 78724

💛 - Coveralls

@Cryoris Cryoris self-assigned this Feb 1, 2023
@Cryoris Cryoris added Changelog: New Feature Include in the "Added" section of the changelog mod: algorithms Related to the Algorithms module labels Feb 1, 2023
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.

Mostly LGTM, I left some small comments below. Could you also add a release note? 🙂

Comment on lines +67 to +70
.. math::

\hat{O} = \frac{1}{N}\sum_{i=1}^N|0_i\rangle\langle 0_i|,

Copy link
Contributor

Choose a reason for hiding this comment

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

This is not formatted correctly:

image

I think you have to add an additional linebreak before the .. math -- but if that doesn't work then you could also put this info in the class docstring 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, adding the extra line break worked 👍

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.

Thanks for the updates!

@mergify mergify bot merged commit 5902b18 into Qiskit:main Feb 1, 2023
pranay1990 pushed a commit to pranay1990/qiskit-terra that referenced this pull request Feb 9, 2023
* local fidelity

* lint

* Update qiskit/algorithms/state_fidelities/compute_uncompute.py

Co-authored-by: Julien Gacon <[email protected]>

* implement suggestions

* doc fix

* private variable renamed

* reno

* try doc fix

---------

Co-authored-by: Julien Gacon <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
ElePT pushed a commit to ElePT/qiskit that referenced this pull request Jun 27, 2023
* local fidelity

* lint

* Update qiskit/algorithms/state_fidelities/compute_uncompute.py

Co-authored-by: Julien Gacon <[email protected]>

* implement suggestions

* doc fix

* private variable renamed

* reno

* try doc fix

---------

Co-authored-by: Julien Gacon <[email protected]>
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
* local fidelity

* lint

* Update qiskit/algorithms/state_fidelities/compute_uncompute.py

Co-authored-by: Julien Gacon <[email protected]>

* implement suggestions

* doc fix

* private variable renamed

* reno

* try doc fix

---------

Co-authored-by: Julien Gacon <[email protected]>
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: New Feature Include in the "Added" section of the changelog Community PR PRs from contributors that are not 'members' of the Qiskit repo mod: algorithms Related to the Algorithms module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants