-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
ENH: Suggest "ignore" mode for ravel_multi_index #15475
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
Comments
Okay, I got it to work for I'm not sure how to address this. Ideally the change would only affect |
I think "forbidden" would be more accurate than "not understood", but this approach (and the overall idea) seems fine to me. |
Another mode which is missing is normal "indexing" mode: a mixture of wrap and raise that wraps negative indices up to |
I'd like to suggest a new
mode
(maybe named"ignore"
) which treatsmulti_index
as index offsets rather than direct positional indices meaning: out-of-bounds indices would be calculated as normal indices, neither wrapped nor clipped and returned without raising an exception.Over at scikit-image/scikit-image#4209 (comment) we would have liked to use np.ravel_multi_index for a use case which is not (yet) supported. The new mode would have allowed us to adjust the
multi_index
corresponding to a structuring element by its center index and simply pass the result intoravel_multi_index
to compute the offsets in question.I am willing to give this a try myself but first wanted to check in with you. I haven't looked to deeply at the code dealing with this yet but my current understanding is that it may be enough to simply add a case that ignores
j < 0 || j >= m
to this switch statement.The text was updated successfully, but these errors were encountered: