Repository navigation
Reorganizes the broadcast functions in numpy and array_api - #4978
Merged
Merged
Conversation
drculhane
force-pushed
the
Closes-4975
branch
2 times, most recently
from
October 7, 2025 13:01
4c3adeb to
689a22b
Compare
drculhane
marked this pull request as ready for review
October 7, 2025 13:02
ajpotts
approved these changes
Oct 8, 2025
ajpotts
left a comment
Contributor
There was a problem hiding this comment.
Great work! Thanks for fixing this!
drculhane
force-pushed
the
Closes-4975
branch
from
October 15, 2025 12:02
121ef9d to
b9fbf8b
Compare
ajpotts
enabled auto-merge
October 15, 2025 14:37
ajpotts
approved these changes
Oct 15, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #4975, adding some organization and numpy alignment to the broadcast functions.
The naming and use of the various broadcast functions in arkouda/numpy and arkouda/array_api have been inconsistent, and out of alignment with numpy.
How it was:
arkouda/array_api/manipulation_functions had: broadcast_arrays and broadcast_to, which did match numpy.
arkouda/numpy/util.py had: broadcast_dims (which does not exist in numpy, though it was similar to broadcast_to),
arkouda/numpy/pdarrayclass.py had: broadcast_to_shapes (same functionality as broadcast_to), and broadcast_if_needed (which also does not exist in numpy).
How it is now:
I left broadcast_if_needed alone. It only appears to be used in binops and nextafter. This can probably be replaced by broadcast_arrays, but I haven't done that yet.
I also left broadcast_dims alone, for now, although I think nothing uses it anymore.
arkouda/numpy/util.py now has broadcast_to, broadcast_shapes, and broadcast_arrays. They match the behavior of the similarly named numpy functions.
arkouda/array_api/manipulation_functions.py has the same broadcast_arrays it had before. The array_api's broadcast_to function now passes its arguments directly to the arkouda/numpy broadcast_to (the parameters are tuples, not pdarrays, so why duplicate the code?).