-
Notifications
You must be signed in to change notification settings - Fork 5
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
Move nsubsystems
from QOBase
#19
Conversation
Codecov Report
@@ Coverage Diff @@
## main #19 +/- ##
==========================================
- Coverage 17.55% 17.38% -0.18%
==========================================
Files 12 12
Lines 393 397 +4
==========================================
Hits 69 69
- Misses 324 328 +4
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
not all AbstractKet have a basis slot in their structure. Here we should have only the function declaration, but these implementations should either make no assumption about the struct or should be in QuantumOpticsBase. Let's say we keep them here, in which case instead of |
Basis and CompositeBasis are defined here, so they are all right. Also bump the patch version number so we can release it promptly. |
could you bump the patch version and add to the changelog? |
src/embed_permute.jl
Outdated
|
||
nsubsystems(s::AbstractKet) = nsubsystems(basis(s)) | ||
function nsubsystems(s::AbstractOperator) | ||
s.basis_l == s.basis_r || throw(ArgumentError("`nsubsystem(::AbstractOperator)` is well defined only if the left and right bases are the same")) |
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 comment as with ::AbstractKet. We can not rely on AbstractOperator to have .basis_l and .basis_r fields.
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 think a basis(op) call will raise an error if the left and right basis are not the same, so maybe just use it directly
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.
should we stick to throwing the current error message with the basis(op) in a try catch or just let the basis(op) error show when the bases are unequal?
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.
no need to stick to the current message, it is fine to rely on whatever message basis throws. Just check that it actually works (you know, never trust me, I can always be wrong ;)
No description provided.