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

Override __copy__ method for QSVT instances #5248

Merged
merged 9 commits into from
Feb 23, 2024
Merged

Conversation

Mandrenkov
Copy link
Contributor

Context:

Unfortunately, #5226 introduced a regression which causes the QSVT in Practice demo to fail. The issue is that the current implementation of Operator.__copy__() copies the data of an Operator before other attributes are copied; however, this is not suitable for QSVT since the QSVT data property depends on the _hyperparameters attribute.

Description of the Change:

  • Added a QSVT.__copy__() method to ensure the data attribute is ignored when QSVT instances are copied.

Benefits:

  • The QSVT in Practice demo succeeds.

Possible Drawbacks:

None.

Related GitHub Issues:

None.

Copy link

codecov bot commented Feb 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.67%. Comparing base (eb03750) to head (796324b).
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5248      +/-   ##
==========================================
- Coverage   99.68%   99.67%   -0.01%     
==========================================
  Files         399      399              
  Lines       36853    36574     -279     
==========================================
- Hits        36736    36456     -280     
- Misses        117      118       +1     

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

@Mandrenkov Mandrenkov marked this pull request as ready for review February 22, 2024 16:53
@trbromley trbromley added this to the v0.35 milestone Feb 23, 2024
@trbromley trbromley added the bug 🐛 Something isn't working label Feb 23, 2024
Copy link
Contributor

@timmysilv timmysilv left a comment

Choose a reason for hiding this comment

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

:shipit: :shipit:

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.

Optional comment about testing, but thanks for fixing this :)

Mandrenkov and others added 3 commits February 23, 2024 13:37
Co-authored-by: Christina Lee <christina@xanadu.ai>
Co-authored-by: Christina Lee <christina@xanadu.ai>
@Mandrenkov Mandrenkov enabled auto-merge (squash) February 23, 2024 18:55
@Mandrenkov Mandrenkov merged commit d3e1bdb into master Feb 23, 2024
38 checks passed
@Mandrenkov Mandrenkov deleted the sc-57276-qsvt-copy branch February 23, 2024 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants