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.
This PR is relatively simple. As it turns out, the codebase was essentially compatible with Numpy 2+ already. For a fuller analysis, see my outline here:
#925
There was one "recommended" (but not mandatory) change, however, that will improve improves numerical stability that I implemented. Under the new "type-promotion" rules (NEP 50) says that when a Python float (default float64) is combined with a float32 array, the result’s dtype follows the higher-precision scalar—i.e., the array is up-cast to float64.
By writing
Basically, we keep the comparison in float32, preserving:
Again, the tweak isn't mandatory, but it keeps the code's code’s performance and dtype expectations identical after upgrading to NumPy 2 +.
Please change the requirements to numpy any version LESS THAN 3...and then when 3 is released we can revisit the issue of compatibility. Thanks.