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

Upgrade qml.lie_closure to handle dense matrices #6811

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

Conversation

Qottmann
Copy link
Contributor

@Qottmann Qottmann commented Jan 13, 2025

Upgrading from labs functionality

labs.dla.lie_closure_dense is integrated into the logic of qml.lie_closure

Also adding qml.pauli.trace_inner_product as a utility function for Pauli matrices and operators.

Integrate lie closure dense to qml lie closure [sc-81965]

Copy link

codecov bot commented Jan 13, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.59%. Comparing base (56044fa) to head (6b6a5c2).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #6811   +/-   ##
=======================================
  Coverage   99.59%   99.59%           
=======================================
  Files         480      481    +1     
  Lines       45551    45625   +74     
=======================================
+ Hits        45366    45440   +74     
  Misses        185      185           

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

@Qottmann Qottmann requested a review from dwierichs January 20, 2025 17:12
Copy link
Contributor

@DSGuala DSGuala left a comment

Choose a reason for hiding this comment

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

Looks good! Left a few comments about doc readability and arguments/UI

pennylane/pauli/dla/lie_closure.py Outdated Show resolved Hide resolved
pennylane/pauli/dla/lie_closure.py Outdated Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we usually avoid having a "utils" submodule if we can name it something more specific or group functions by their usage.

Since we only have one function in here for now (trace_inner_product), does it still make sense to add the util.py file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm expecting there to be more "utility functions", see e.g. here

Copy link
Contributor Author

@Qottmann Qottmann Jan 20, 2025

Choose a reason for hiding this comment

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

Surely not all of them, but some might make sense to keep public because they are used in different places and might be handy for users

Copy link
Contributor

Choose a reason for hiding this comment

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

I totally agree that trace_inner_product is very important and handy for any interested physicists. But why did we put it under pauli/dla? I feel logically they should be directly under pauli, although I feel right now the public documentation is also good with trace_inner_product having a separate subsection; probably @DSGuala can help double check from the UI perspective here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I also like the idea of just putting it in pennylane.pauli 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I moved trace_inner_product to a level higher to just the pauli module.
We might end up needing a util section for DLA stuff but that is independent of this discussion. I'm happy with having trace_inner_product in pauli

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also worth mentioning that the plan is to move DLA functioanlity to a new liealg module. I just opted to not do this here since this PR is already quite large

pennylane/pauli/dla/lie_closure.py Outdated Show resolved Hide resolved
Copy link
Contributor

@dwierichs dwierichs left a comment

Choose a reason for hiding this comment

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

Nice and thorough job, @Qottmann 🎉
This basically looks good to go for me, just with the change dense -> matrix pending on the earlier files (by order of git diff :D)

I am wondering whether the trace inner product should be a qml.math feature?

pennylane/labs/dla/structure_constants_dense.py Outdated Show resolved Hide resolved
pennylane/labs/dla/structure_constants_dense.py Outdated Show resolved Hide resolved
pennylane/labs/tests/dla/test_variational_kak.py Outdated Show resolved Hide resolved
pennylane/pauli/dla/lie_closure.py Outdated Show resolved Hide resolved
Copy link
Contributor

@dwierichs dwierichs 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 quick updates!
Looks good to go from my side now :) 🎉
Nice work @Qottmann 💯

Copy link
Contributor

@JerryChen97 JerryChen97 left a comment

Choose a reason for hiding this comment

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

Happy to see the merge of new dla features into PL! Especially the very helpful trace_inner_product method. Just some minor questions left on my side

pennylane/labs/dla/structure_constants_dense.py Outdated Show resolved Hide resolved
pennylane/labs/dla/structure_constants_dense.py Outdated Show resolved Hide resolved
pennylane/labs/dla/cartan_subalgebra.py Outdated Show resolved Hide resolved
pennylane/labs/dla/structure_constants_dense.py Outdated Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

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

I totally agree that trace_inner_product is very important and handy for any interested physicists. But why did we put it under pauli/dla? I feel logically they should be directly under pauli, although I feel right now the public documentation is also good with trace_inner_product having a separate subsection; probably @DSGuala can help double check from the UI perspective here.

pennylane/pauli/dla/util.py Outdated Show resolved Hide resolved
@Qottmann Qottmann requested a review from JerryChen97 January 30, 2025 09:52
Copy link
Contributor

@JerryChen97 JerryChen97 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!

@Qottmann
Copy link
Contributor Author

Qottmann commented Feb 7, 2025

@DSGuala do you want to give this another look before I merge? :)

@Qottmann Qottmann requested a review from AntonNI8 February 11, 2025 14:29
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.

4 participants