-
Notifications
You must be signed in to change notification settings - Fork 15
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
Separate normalized and unnormalized objects #50
Conversation
## trace | ||
|
||
tr(x::SingleRailMidSwapBellU) = Float64(tr(express(x).data)) |
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.
lets remove these -- unless it is some special constant, it does not make sense to implicitly turn a symbolic object into a float
src/StatesZoo/zalm_pair/zalm_pair.jl
Outdated
|
||
## trace | ||
tr(x::ZALMSpinPairU) = Float64(tr(express(x).data)) |
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.
same here
test/test_stateszoo_api.jl
Outdated
|
||
@test tr(zalmU) < 1.0 | ||
@test tr(express(zalmN).data) ≈ 1 |
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.
on the other hand, these should be exactly equal to 1 thanks to a special dispatch rule (so that express
does not need to be used, nor .data
)
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.
Wouldn't we still need to use express to convert it to QuantumOptics
formalism so that this specialised method can be called
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.
I would prefer if we do not rely on quantumoptics.jl at all for that.
In symbolic CAS tools usually 1 and 0 are treated more specially than other numbers. For the normalized density matrices here it is guaranteed that the trace is 1, so I would like to have a special-cased method for them that completely shortcuts any expression functionality.
@test tr(rho) = tr(express(rho))
should work for them.
Please add these special-cased methods for tr
and I should be able to merge.
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.
@Abhishek-1Bhatt , bump
Codecov Report
@@ Coverage Diff @@
## master #50 +/- ##
==========================================
+ Coverage 63.29% 63.69% +0.39%
==========================================
Files 27 27
Lines 1079 1099 +20
==========================================
+ Hits 683 700 +17
- Misses 396 399 +3
... and 2 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
I have been trying to think about names, specifically suffixes, that will lead to the least amount of confusion. My main worry is that Maybe changing Do you have any thoughts on this? Happy to merge as is and then do a renaming PR or to discuss naming here before merging. |
Separated the symbolic objects into normalized and unnormalized, added a dispatch of
tr
fromLinearAlgebra.jl
for computing the trace of the unnormalized objects and fixed tests according to the new naming convention