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

Add __mul__ dunder method #2891

Merged
merged 38 commits into from
Aug 5, 2022
Merged

Add __mul__ dunder method #2891

merged 38 commits into from
Aug 5, 2022

Conversation

AlbertMitjans
Copy link
Contributor

@AlbertMitjans AlbertMitjans commented Aug 4, 2022

Add __mul__ and __matmul__ dunder methods to the Operator class.

@codecov
Copy link

codecov bot commented Aug 4, 2022

Codecov Report

Merging #2891 (4d6f3cf) into master (1f149fc) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #2891   +/-   ##
=======================================
  Coverage   99.65%   99.65%           
=======================================
  Files         258      258           
  Lines       21759    21772   +13     
=======================================
+ Hits        21683    21696   +13     
  Misses         76       76           
Impacted Files Coverage Δ
pennylane/__init__.py 100.00% <100.00%> (ø)
pennylane/operation.py 96.78% <100.00%> (+0.07%) ⬆️
pennylane/ops/qubit/hamiltonian.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.

@AlbertMitjans AlbertMitjans marked this pull request as ready for review August 4, 2022 10:29
@AlbertMitjans AlbertMitjans added review-ready 👌 PRs which are ready for review by someone from the core team. and removed review-ready 👌 PRs which are ready for review by someone from the core team. labels Aug 4, 2022
@albi3ro albi3ro added the op-arithmetic PR's involved in introducing operator arithmetic label Aug 4, 2022
@albi3ro albi3ro added this to the v0.25.0 milestone Aug 4, 2022
Copy link
Contributor

@Jaybsoni Jaybsoni 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 to me! Just a few small comments! Also, I think there are some errors that get raised in the Hamiltonian class because we don't currently support multiplication of Hamiltonians. Maybe in the error message there we can direct users to the Prod class.

Just some small changes and then happy to approve 👍🏼

pennylane/operation.py Outdated Show resolved Hide resolved
pennylane/operation.py Outdated Show resolved Hide resolved
pennylane/ops/qubit/hamiltonian.py Show resolved Hide resolved
tests/test_operation.py Outdated Show resolved Hide resolved
AlbertMitjans and others added 4 commits August 4, 2022 18:09
Co-authored-by: Jay Soni <jbsoni@uwaterloo.ca>
Co-authored-by: Jay Soni <jbsoni@uwaterloo.ca>
Co-authored-by: Jay Soni <jbsoni@uwaterloo.ca>
pennylane/operation.py Outdated Show resolved Hide resolved
pennylane/operation.py Outdated Show resolved Hide resolved
pennylane/operation.py Outdated Show resolved Hide resolved
pennylane/operation.py Outdated Show resolved Hide resolved
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.

Excellent job! 🎉

Co-authored-by: Christina Lee <christina@xanadu.ai>
Copy link
Contributor

@Jaybsoni Jaybsoni left a comment

Choose a reason for hiding this comment

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

Looks great! 💯

@AlbertMitjans AlbertMitjans merged commit 2bcb861 into master Aug 5, 2022
@AlbertMitjans AlbertMitjans deleted the mul_dunder_method branch August 5, 2022 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
op-arithmetic PR's involved in introducing operator arithmetic
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants