Skip to content
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

Remember to implement arrays of 2D/3D/Lorentz vectors in Numba #43

Open
jpivarski opened this issue Mar 24, 2021 · 1 comment
Open

Remember to implement arrays of 2D/3D/Lorentz vectors in Numba #43

jpivarski opened this issue Mar 24, 2021 · 1 comment
Labels
feature New feature or request

Comments

@jpivarski
Copy link
Member

jpivarski commented Mar 24, 2021

PR #42 had to stop early because we need Numba to let us recognize np.ndarray subclasses inside of a Numba-compiled function. This feature is being implemented, but it is not finished or in any released version of Numba yet: numba/numba#6148.

When that is done, we can follow the procedure described in numba/numba#6148 (comment) to:

  • Override __getitem__ to return the appropriate VectorObject*DType when it would otherwise return a np.record.
  • (Presumably, @DrTodd13's implementation would ensure that other slices maintain their class. If not, include that in the __getitem__ override. Currently, a VectorNumpy loses its class—becoming a plain np.ndarray—when it is range-sliced; this will have to be tested.)
  • (It might also be necessary to override an array iterator.)
  • Override __array_ufunc__ for the relevant ufuncs (np.absolute, np.add, np.equal, etc.).

That's it! Not nearly as much work as vector.backends.numba_object.

@henryiii
Copy link
Member

As mentioned in scikit-hep/vector#43, this capability is blocked by numba/numba#6148.

This PR was supplanted by numba/numba#7121, which was added in Numba 0.54, so this should be unblocked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants