-
Notifications
You must be signed in to change notification settings - Fork 31
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
Add FiniteMPS
getindex
#218
Add FiniteMPS
getindex
#218
Conversation
@lkdvos can you look at the implementation as well as if the |
Codecov ReportAll modified and coverable lines are covered by tests ✅
|
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.
Looks okay to me!
For the boundscheck
business: the long story short (ish) is that @inbounds
will bypass code that is marked within a @boundscheck
block, on the condition that it is inlined, or passed through a function barrier with @propagate_inbounds
.
Boundschecking itself happens by the function checkbounds
, which has two signatures: checkbounds(Bool, args...)
and checkbounds(args...)
. The first outputs a bool to check the bounds, the second calls the first and throws if necessary.
In general, the boundschecking really only matters for performance-critical sections, or expensive boundschecks. I like putting an extra check in the function, as this gives clearer error messages, but putting @inbounds
should only be used as a last resort, since that can lead to segfaults.
Could you try and add some tests for this, testing inferred, proper error throwing etc? Nothing too major, but just a few lines to ensure everything is (and keeps) functioning property would be great.
Co-authored-by: Lukas Devos <[email protected]>
Co-authored-by: Lukas Devos <[email protected]>
This PR implements
getindex
forFiniteMPS
using bothInteger
s andAbstractUnitRange
s.