-
Notifications
You must be signed in to change notification settings - Fork 12
Deprecate PauliBasis
#52
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
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #52 +/- ##
==========================================
+ Coverage 34.75% 34.90% +0.15%
==========================================
Files 15 15
Lines 423 424 +1
==========================================
+ Hits 147 148 +1
Misses 276 276 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
961b25e to
8d90ad5
Compare
|
let's change the phrasing a bit. How about we just rename it to As an added bonus, this would make the change drastically smaller, with little to no code moved around. |
Krastanov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left a comment with a suggested simplification for this. I prefer using the standard deprecation macros instead of custom messages.
If we are deprecating this name, we should not use it again in the future for something else. That would just cause problems.
Marking as draft to keep my review queue manageable. Please mark back as ready whenever convenient.
|
Hm I'm not sure I like the implication of never being able to use the name So perhaps a different path forward would be to just not deprecate, but change it's struct members as necessary for changes in the superoperator code which unify superoperators and pauli transfer matrices given they're simply related by a basis change? I already have this working in #55 and qojulia/QuantumOpticsBase.jl#196 |
|
I agree that it is misleading to call this basis a "Pauli Basis", but that mistake was made and we should not break user code that relies on the mistake. The deprecation is to avoid future user code to use something with a confusing name. While it would be much neater to get to use this name for something for which it actually applies, the cost in terms of future confusion is just too great. If you need something to represent a basis of the space of operators, we can use a name like |
I would be very surprised if there is code that uses
But I suppose this maybe irrelevant if the goal is to hang onto this basis in some form and the constraint is that we cannot use this name for an operator basis.
That is okay with me for the operator basis.
I think we should decide on what "the canonical qubit basis" should be. The current de facto basis seems to be Deciding this is necessary for the new basis and superoperator interface and subsequent improved implementations of the Pauli transfer matrix and chi matrix because
|
|
Hmmm on further though I'm actually not sure a separate |
8d90ad5 to
a0e80f0
Compare
|
Your reasoning sounds good to me, at least to the extent I follow. If If one day someone explains why Q1: The PR that introduced Q2: Could you double check the deprecation message -- it feels like there is a word or subclause missing from it? Feel free to merge this and the related PR and do version bumps and releases after this is done. Just make sure tests are passing and that we indeed just have deprecations, not breakages. |
a0e80f0 to
3f46199
Compare
Yes the Pauli transfer matrix (PTM) and Chi process matrix which it introduced are things I'm working on updating with the new basis interface and have been helpful in guiding what that looks like. Since the PTM and Chi matrix are just the superoperator and choi state in the Pauli operator basis respectively, it makes sense for them to share common code (and this also gives algorithmic speedups from the current implementations). But this leads me to a question. Originally
Oops, fixed now. Unless there's anything else, I'll merge and release tomorrow! |
yeah... My take is that you are describing a philosophical conundrum at the core of Julia dev style and at the core of the "expression problem". What follows is a personal opinion: Types in function signatures in julia are to manage dispatch, not to ensure correctness. Even typeasserts in function bodies are there just to help the compiler, not to ensure correctness. Julia types do not let you specify an "interface", e.g. you might very well have something that behaves like an integer (it informally implements the Integer interface/contract), but it does not subtype Integer. Julia types might let you specify traits, which can provide some similar capabilities valuable for correctness checking, but that is a manual process not well supported by dev tooling and linters. Thus, relaxing types in function signatures, and relaxing type constraints in structs (while keeping the structs concrete, just more highly parameterized) enables much higher interoperability between packages. Because the Julia compiler will specialize all methods anyway, you do not lose on performance. But indeed, this higher "interoperability" thanks to lessened type constraints, leads to fewer "correctness constraints promised by the compiler". I claim these correctness constraints would have been bad anyway, because they should be based on interfaces (which julia does not support yet). An example where such a "correctness constraint" was very annoying for me and stopped me from implementing a cool feature in a symbolic-numeric monte-carlo simulator: JuliaCollections/DataStructures.jl#860 -- removing this constraint made this possible in a symbolic manner: https://qc.quantumsavory.org/dev/noisycircuits_perturb/ Some suggestions for potential implementation of interfaces in julia: https://hackmd.io/BbEw0_B4Q8uDSS34LOvpCw Anyway, my rant does not really change your plans, but hopefully it explains the philosophy behind the changes you referenced. For the moment please stick to your plan to be strict with type constraints -- we can relax things when necessary. |
Thank you for that insightful comment and the interesting link! That definitely helps clarify the issue as a sort of tension between interoperability and typing checking arising from the lack of formal interfaces. |
Applies on top of #41. Closes #36. See #39 for more discussion.
I think eventual removal of
PauliBasisrather than deprecation with renaming makes the most sense. This is because it is identical toSpinBasis(1//2)^N, however with the sever downside that it is not compatible with any of theCompositeBasismachinery such asreduced,ptrace,embed,permutesystems, etc...