-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Allow : in reshape #16790
Comments
IIRC, Python uses a -1 to achieve what you propose. I have to say that I never really liked it so much, and : looks way cleaner. |
More generally, B = reshape(A, N1, N2, N3, :) etc; (should be a fairly easy hack?) |
Yes I love this. Have wanted it so many times. |
Even more generally, allow a single colon in any position: B = reshape(A, N1, :, N3, N4) Should still be perfectly implementable. |
I remember proposing this a while ago in some issue and it wasn't generally liked. |
I forget what the objection was before. Seems like a reasonable thing to me. It's possible that it was before |
didn't |
@malmaud I think it was #4263 (search term) |
sorry I missed PR - anyhow it would be great if this feature could now be added |
+1. I think it's handy and useful. That's why I tried resurrecting your PR… but it got no traction at the time. Anyone's welcome to update either of my old commits and try it again. At a minimum the tests should be useful. |
I feel like this is a common usage pattern and would be nice to have in Julia. MATLAB, for example, uses empty [] to tell reshape to compute the missing dimension: https://www.mathworks.com/help/matlab/ref/reshape.html#examples |
* Support using colon to omit a dimension in reshape Closes #16790. * Add NEWS.md
I find myself writing a lot of this:
Instead, I'd like to write
The text was updated successfully, but these errors were encountered: