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

Support Sparse Matrix representation for Observables and Arithmetic Ops (1/3) #2964

Merged
merged 17 commits into from Aug 22, 2022

Conversation

Jaybsoni
Copy link
Contributor

@Jaybsoni Jaybsoni commented Aug 16, 2022

Context:
We want to support sparse matrix representation for Symbolic operators, these depend on the sparse matrix attributes of their factors/summands/base operators. We must then also support sparse matrix representations for a few other operators; we choose to support observables as these have useful applications (eg. Quantum Chemistry).

Description of the Change:
Implement the sparse_matrix() property for some well known PL observables. Add a sparse expand method to handle varying wire labels.

Benefits:
Performance boost when computing expectation values / other measurements using operator arithmetic or observables.

Closes #2882

@Jaybsoni Jaybsoni added the WIP 🚧 Work-in-progress label Aug 16, 2022
@github-actions
Copy link
Contributor

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 Aug 16, 2022

Codecov Report

Merging #2964 (ab92ae2) into master (754f2c9) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #2964   +/-   ##
=======================================
  Coverage   99.65%   99.65%           
=======================================
  Files         266      266           
  Lines       22318    22335   +17     
=======================================
+ Hits        22241    22258   +17     
  Misses         77       77           
Impacted Files Coverage Δ
pennylane/ops/identity.py 100.00% <100.00%> (ø)
pennylane/ops/qubit/non_parametric_ops.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@Jaybsoni Jaybsoni added review-ready 👌 PRs which are ready for review by someone from the core team. and removed WIP 🚧 Work-in-progress labels Aug 19, 2022
@Jaybsoni Jaybsoni changed the title [WIP] Support Sparse Matrix representation for Observables and Arithmetic Ops Support Sparse Matrix representation for Observables and Arithmetic Ops (1/3) Aug 19, 2022
Copy link
Contributor

@albi3ro albi3ro left a comment

Choose a reason for hiding this comment

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

This will be a good starting point for further development and feature coverage of sparse matrices!

@Jaybsoni Jaybsoni merged commit ff273af into master Aug 22, 2022
@Jaybsoni Jaybsoni deleted the sparse_paulis branch August 22, 2022 14:20
@Jaybsoni
Copy link
Contributor Author

Jaybsoni commented Aug 22, 2022

[sc-24922]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
review-ready 👌 PRs which are ready for review by someone from the core team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add sparse matrix representations for Pauli Operators
2 participants