StatePrepBase2#9562
Open
comp-phys-marc wants to merge 10 commits into
Open
Conversation
albi3ro
reviewed
Jun 2, 2026
Co-authored-by: Christina Lee <christina@xanadu.ai>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## new-operator-compute-methods #9562 +/- ##
=============================================================
Coverage 99.45% 99.45%
=============================================================
Files 611 611
Lines 67738 67746 +8
=============================================================
+ Hits 67371 67379 +8
Misses 367 367 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
mudit2812
reviewed
Jun 3, 2026
Comment on lines
+1277
to
+1284
| def label( | ||
| self, | ||
| decimals: int | None = None, | ||
| base_label: str | None = None, | ||
| cache: dict | None = None, | ||
| ) -> str: # pylint: disable=unused-argument | ||
| """The default label for a state prep.""" | ||
| return "|Ψ⟩" |
Contributor
There was a problem hiding this comment.
This might be problematic. If you create a state prep operator, what its label looks like will depend on the order of inheritance. Consider the following:
class A:
def foo(self):
return "hi"
class B:
def foo(self):
return "bye"
class C(A, B):
pass
class D(B, A):
pass>>> print(C().foo())
hi
>>> print(D().foo())
bye
Contributor
There was a problem hiding this comment.
We may just need to make StatePrepBase2 a subclass of Operator2. I'm not sure there are other ways to resolve this issue.
Contributor
Author
There was a problem hiding this comment.
Ok, thanks for the suggestion. I've done this in my latest change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context: We want new base abstractions based on
Operator2. This includes aStatePrepBase2class.Description of the Change: Implements the new
StatePrepBase2base class and its test.Benefits: We can integrate better with Catalyst, capture, etc.
Possible Drawbacks: N/A
Related GitHub Issues: [sc-120744]