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

Remove state vector support from math/quantum.py #4322

Merged
merged 10 commits into from Jul 9, 2023

Conversation

eddddddy
Copy link
Collaborator

@eddddddy eddddddy commented Jul 5, 2023

Context:
Part of the deprecations/removals for 0.32. This PR is a followup to the deprecation of state-vector arguments to most functions in pennylane/math/quantum.py.

Description of the Change:
Remove state-vector support from purity, vn_entropy, mutual_info, fidelity, relative_entropy, and max_entropy.

Also add another function fidelity_statevector which computes the fidelity given two state-vectors, since this is a widely-used case that could benefit from a separate function.

@github-actions
Copy link
Contributor

github-actions bot commented Jul 5, 2023

Hello. You may have forgotten to update the changelog!
Please edit doc/releases/changelog-dev.md with:

  • A one-to-two sentence description of the change. You may include a small working example for new features.
  • A link back to this PR.
  • Your name (or GitHub username) in the contributors section.

@codecov
Copy link

codecov bot commented Jul 5, 2023

Codecov Report

Merging #4322 (7b3e601) into master (34d2fb2) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #4322      +/-   ##
==========================================
- Coverage   99.79%   99.79%   -0.01%     
==========================================
  Files         351      351              
  Lines       32101    32058      -43     
==========================================
- Hits        32034    31991      -43     
  Misses         67       67              
Impacted Files Coverage Δ
pennylane/math/__init__.py 100.00% <ø> (ø)
pennylane/_qubit_device.py 99.29% <100.00%> (ø)
pennylane/devices/default_mixed.py 100.00% <100.00%> (ø)
pennylane/math/quantum.py 100.00% <100.00%> (ø)
pennylane/measurements/mutual_info.py 100.00% <100.00%> (ø)
pennylane/measurements/purity.py 100.00% <100.00%> (ø)
pennylane/measurements/vn_entropy.py 100.00% <100.00%> (ø)

@eddddddy eddddddy requested a review from a team July 6, 2023 15:51
Copy link
Contributor

@timmysilv timmysilv left a comment

Choose a reason for hiding this comment

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

🎉 also not sure about the name, but I'm fine with what's here

pennylane/math/quantum.py Outdated Show resolved Hide resolved
@eddddddy eddddddy requested a review from a team July 6, 2023 19:57
@mudit2812 mudit2812 self-requested a review July 7, 2023 15:25
@eddddddy
Copy link
Collaborator Author

eddddddy commented Jul 7, 2023

@timmysilv I'm happy to consider alternative suggestions for the name fidelity_statevector, but @trbromley confirmed that it should be fine as is.

@eddddddy
Copy link
Collaborator Author

eddddddy commented Jul 7, 2023

[sc-41139]

@timmysilv
Copy link
Contributor

my comment was misleading now that I read it, I'm not picky on the name :shipit:

@eddddddy eddddddy merged commit 030447e into master Jul 9, 2023
43 checks passed
@eddddddy eddddddy deleted the deprecate_state_vector branch July 9, 2023 17:01
mudit2812 pushed a commit that referenced this pull request Jul 10, 2023
* Remove statevector support for qinfo functions

* remove unused funcs

* Fix some tests

* pylint

* more pylint

* Remove unnecessary log

* Changelog and deprecations entry

* trigger ci
mudit2812 added a commit that referenced this pull request Jul 11, 2023
* Adding changes for shift rules

* Testing changes

* Fixed op indices

* Fixed indexing

* Updated `bind_new_parameters`

* Updated `tape.get_operation`

* Updated tests

* Test updates; multishifting works

* Fixing interface

* Updated shifting; added dispatch for templates

* Updated shifting function

* Fixed index error

* Removed commented code

* [skip ci] Reverted changes to `bind_new_parameters

* Update to remove copying

* Update changelog

* Apply suggestions from code review

Co-authored-by: Matthew Silverman <matthews@xanadu.ai>

* Removed unused import

* Roll back suggested change

* Remove state vector support from `math/quantum.py` (#4322)

* Remove statevector support for qinfo functions

* remove unused funcs

* Fix some tests

* pylint

* more pylint

* Remove unnecessary log

* Changelog and deprecations entry

* trigger ci

* Enable CI and pre-commit hook to lint tests (#4335)

* rename all legacy test files to match pylint pattern

* pylint all tests in CI and pre-commit

* lint legacy/qnn/conftest

* remove the custom pylint test handling

* run black before pylint

* changelog

---------

Co-authored-by: David Wierichs <david.wierichs@xanadu.ai>

* Update broadcasting transforms to use `bind_new_parameters` (#4288)

* use bind_new_parameters

* pylint

* remove batching in measurements and add tests

* More coverage issues

* Add uncopied tests

* Helper function

* pylint

* Make tape._ops public

* use private methods

* pylint

* Add more docs to split_operations

* pylint

* Deprecate X and P (#4330)

* update in docs

* update changelog

* Test warning is raised

* update default gaussian device

* update tests

* update more tests

* fix legacy tests

* Specify v0.33 removal in docstring

* Render X and P in docs

* move deprecation warning in docstring

* fix sphinx linking

* add warning box

* Support wire labels in `qinfo` transforms (#4331)

* Support wire labels in qinfo transforms

* changelog

* pylint and update test

* add bugfix entry

* Deprecations for 0.32 from me! (#4316)

* deprecate the old return system

* deprecate the mode kwarg for QNode

* changelog

* PR feedback

* update notice to avoid wrongly suggesting action needed

* update docstrings, docs and warnings

* add link to qnode returns doc

* change the mode warning depending on return system active

* also add disclaimer to docstring

---------

Co-authored-by: Matthew Silverman <matthews@xanadu.ai>
Co-authored-by: Edward Jiang <34989448+eddddddy@users.noreply.github.com>
Co-authored-by: David Wierichs <david.wierichs@xanadu.ai>
Co-authored-by: lillian542 <38584660+lillian542@users.noreply.github.com>
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.

None yet

3 participants