Skip to content

Conversation

@forfudan
Copy link
Collaborator

This PR updates the numojo.math.extrema module and performs some other optimization work:

  • Update max() and min() to allow both C and F order arrays and by any axis.
  • Unify all the overloads and function signatures. The maxT() and minT() are removed.
  • Update the max() and min() methods for NDArray type.
  • Some other optimization work, including:
    • Use // and % to replace divmod() in all cases.
    • Use a.size attribute to replace a.num_elements() method in all cases.
    • Remove unnecessary copy of memory in the apply_func_over_axis functions.
    • Increase the speed of nditer by not re-constructing the strides in every loop.

Copy link
Collaborator

@MadAlex1997 MadAlex1997 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work on vectorizing the extrema functions with axis properties. I also like that we are now mirroring numpy with size being a field and the default way to get the total number of elements.

@MadAlex1997 MadAlex1997 merged commit 148db64 into Mojo-Numerics-and-Algorithms-group:pre-0.6 Feb 17, 2025
2 checks passed
@forfudan forfudan deleted the extrema branch February 17, 2025 22:59
@forfudan
Copy link
Collaborator Author

Good work on vectorizing the extrema functions with axis properties. I also like that we are now mirroring numpy with size being a field and the default way to get the total number of elements.

Thanks! I think with this apply_func_by_axis function, we can quickly implement all core ndarray methods which take axis as an argument. Maybe this can be a milestone for v0.6.

@MadAlex1997
Copy link
Collaborator

Good work on vectorizing the extrema functions with axis properties. I also like that we are now mirroring numpy with size being a field and the default way to get the total number of elements.

Thanks! I think with this apply_func_by_axis function, we can quickly implement all core ndarray methods which take axis as an argument. Maybe this can be a milestone for v0.6.

Between that and the 25.1 Mojo update it seems like an appropriate time for main to go to 0.6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants