-
Notifications
You must be signed in to change notification settings - Fork 72
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
numba: Add support for the projection operator #336
Conversation
@numba.njit | ||
def _project(mv, grade): | ||
""" fast grade projection """ | ||
output = np.zeros_like(mv.value) | ||
if grade == 0: | ||
output[0] = mv.value[0] | ||
elif grade == 1: | ||
output[1:6] = mv.value[1:6] | ||
elif grade == 2: | ||
output[6:16] = mv.value[6:16] | ||
elif grade == 3: | ||
output[16:26] = mv.value[16:26] | ||
elif grade == 4: | ||
output[26:31] = mv.value[26:31] | ||
elif grade == 5: | ||
output[31] = mv.value[31] | ||
return mv.layout.MultiVector(output) |
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.
This doesn't actually seem to be any faster than my approach.
This pull request introduces 3 alerts when merging c77a631 into bb0e2d1 - view on LGTM.com new alerts:
|
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 good to me
Numba does not make it easy to overload `__call__` at the moment. We should follow up with numba to see if they can make it easier in future.
This pull request introduces 2 alerts when merging 581a135 into bb0e2d1 - view on LGTM.com new alerts:
|
3.8 CI is the usual, LGTM complaints are github/codeql#3741 (invalid) and don't-care. |
Numba does not make it easy to overload
__call__
at the moment.We should follow up with numba to see if they can make it easier in future.
xref numba/numba#5885.