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

Make Conditional a SymbolicOp #5772

Merged
merged 12 commits into from
Jun 5, 2024
Merged

Make Conditional a SymbolicOp #5772

merged 12 commits into from
Jun 5, 2024

Conversation

EmilianoG-byte
Copy link
Contributor

@EmilianoG-byte EmilianoG-byte commented May 30, 2024

Context:

The Conditional class currently inherits from Operator, such that many attributes and methods are missing.

Description of the Change:

By switching to inherit from SymbolicOp, the Conditional class now includes some common default behaviour, such as deferring properties to the base class, copying the base class during a shallow copy, and updating the metadata of the base operator during queueing.

In addition, other relevant representations have been added and tested, e.g.: matrix, adjoint, diagonalizing_gates, and eigvals.

As part of the work needed for this PR, new dispatches for qml.Conditional and qml.MeasurementValue have been added to the qml.equal() function.

Benefits:
Seamlessly inheritance of properties and basic methods implemented by SymbolicOp, including differing of properties.

Possible Drawbacks:
Have to make sure that is not a breaking change as some attributes/methods of Conditional are changed.
Need to rethink approach for decomposition of Conditional operators.

[sc-61356]

implement eigvals, matrix, and decomposition
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.

@EmilianoG-byte EmilianoG-byte changed the title [WIP] Make Conditional a SymbolicOp Make Conditional a SymbolicOp Jun 3, 2024
@EmilianoG-byte EmilianoG-byte marked this pull request as ready for review June 3, 2024 15:29
Copy link

codecov bot commented Jun 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.66%. Comparing base (e2d6514) to head (8c84f6c).
Report is 252 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5772      +/-   ##
==========================================
- Coverage   99.66%   99.66%   -0.01%     
==========================================
  Files         414      414              
  Lines       39466    39194     -272     
==========================================
- Hits        39334    39061     -273     
- Misses        132      133       +1     

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

Copy link
Contributor

@astralcai astralcai left a comment

Choose a reason for hiding this comment

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

LGTM 🎸

Copy link
Contributor

@PietropaoloFrisoni PietropaoloFrisoni left a comment

Choose a reason for hiding this comment

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

That's amazing @EmilianoG-byte , thanks!

I just left a couple of minor suggestions 👍

doc/releases/changelog-dev.md Outdated Show resolved Hide resolved
tests/ops/op_math/test_condition.py Outdated Show resolved Hide resolved
@EmilianoG-byte EmilianoG-byte merged commit 7384db3 into master Jun 5, 2024
40 checks passed
@EmilianoG-byte EmilianoG-byte deleted the symbolic_conditional branch June 5, 2024 23:02
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.

3 participants