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

Move contents of pennylane.utils to appropriate modules #6588

Open
wants to merge 16 commits into
base: master
Choose a base branch
from

Conversation

JerryChen97
Copy link
Contributor

@JerryChen97 JerryChen97 commented Nov 14, 2024

Context:
The legacy remains qml.utils module has been hanging around for long. Now, finally we are to delete them and move the remaining folks to wherever they're supposed to be.
Specifically, the
following 4 sets of functions have been either moved or removed:

  • qml.utils._flatten, qml.utils.unflatten has been moved and renamed to
    qml.pytrees.flatten_np and qml.pytrees.unflatten_np respectively.

  • qml.utils._inv_dict and qml._get_default_args have been removed.

  • qml.utils.pauli_eigs has been moved to qml.pauli.utils.

  • qml.utils.expand_vector has been moved to qml.math.expand_vector.
    Description of the Change:

Benefits:
Less redundancy

Possible Drawbacks:
Rare chance that some downstreaming repo might be using these funcationalities:

  • lightning
  • catalyst
  • qml
  • plugins

We will come back to check them one by one to make sure nothing is to break

Related GitHub Issues:

Related Shortcut Stories:
[sc-76906]

@JerryChen97 JerryChen97 self-assigned this Nov 14, 2024
pennylane/math/quantum.py Outdated Show resolved Hide resolved
@@ -2346,7 +2345,7 @@ def eigvals(self):
standard_observables = {"PauliX", "PauliY", "PauliZ", "Hadamard"}

# observable should be Z^{\otimes n}
self._eigvals_cache = pauli_eigs(len(self.wires))
self._eigvals_cache = qml.pauli.pauli_eigs(len(self.wires))
Copy link
Contributor

Choose a reason for hiding this comment

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

Note that Tensor is getting removed by @lillian542 , so there will be a merge conflict.

@PennyLaneAI PennyLaneAI deleted a comment from github-actions bot Nov 14, 2024
@JerryChen97 JerryChen97 marked this pull request as ready for review November 14, 2024 23:29
Copy link

codecov bot commented Nov 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.29%. Comparing base (a0e69cc) to head (c3d5845).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6588      +/-   ##
==========================================
- Coverage   99.29%   99.29%   -0.01%     
==========================================
  Files         454      453       -1     
  Lines       43264    43248      -16     
==========================================
- Hits        42961    42945      -16     
  Misses        303      303              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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