BUG: fix mgrid output for lower precision float inputs#16815
Merged
mattip merged 5 commits intonumpy:masterfrom Jul 25, 2020
Merged
BUG: fix mgrid output for lower precision float inputs#16815mattip merged 5 commits intonumpy:masterfrom
mattip merged 5 commits intonumpy:masterfrom
Conversation
Floats besides float64 were being coerced to integers and complex step sizes for the index trick classes would fail for complex64 input. Fixes numpy#16466
eric-wieser
reviewed
Jul 12, 2020
rossbar
reviewed
Jul 13, 2020
Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
Contributor
Author
|
Let me know if there is anything else or if I need to squash the smaller commits, I'm not sure what NumPy's preference is. |
rossbar
approved these changes
Jul 14, 2020
Contributor
rossbar
left a comment
There was a problem hiding this comment.
LGTM - thanks @cjblocker !
eric-wieser
approved these changes
Jul 24, 2020
Member
eric-wieser
left a comment
There was a problem hiding this comment.
Looks reasonable to me too - I still wonder if we want to produce a float32 result for some of these cases, but that can be a follow-up.
Member
|
Since this is a pretty visible bug-fix, do we want to mention it in the release notes? |
Contributor
Author
|
@mattip Seems reasonable, I went ahead and wrote a release note. |
Member
|
Thanks @cjblocker and reviewers |
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.
Floats besides float64 were being coerced to integers in np.mgrid and complex step sizes for the index trick classes would fail for complex64 input. Fixes #16466
Before:
After:
The input types do not affect the output dtype, which are always int64 or float64, but they can affect the output in other ways due to
arangeprecision issues (#5808).@seberg mentioned that the
mgridcode could use a refactor. A lot of its functionality is duplicated inAxisConcatenatorandmeshgrid. I think the code could almost be replaced bynp.meshgrid(*[np.r_[k.start:k.stop:k.step] for k in key], sparse=self.sparse). I could verify this and clean it up if it sounds reasonable.