-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Feature request: T
method for transposition applying to 1D vectors
#9530
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
Transpose doesn't change the number of dimensions, just reverses their order. I think another function would be needed, and the multidimensional case should also be included. |
Yeah, I think what's really needed here is a "transpose last two axes" function (#7495), in which automatic promotion from 1d to 2d seems reasonable |
@jolespin: Notice that @eric-wieser: So would a 1d array be promoted to a row vector or a column vector before being transposed? If we had an operation to swap the last two axes, then it would make more sense to me if it fails when there aren't two axes to swap. In the face of ambiguity, refuse the temptation to guess, and all that. |
@njsmith You'd promote an |
Also, I should draw attention to the edit to my original comment linking to a mostly-duplicate issue, #7495 |
I don't think broadcasting is relevant here at all. Broadcasting is a way of lining up parallel loops, not a method for arbitrary munging of arrays to meet some shape requirement. Note that Also, if that's the promotion behavior you want you can already get it by explicitly writing |
+1 Using the model of generalized ufuncs, the "transpose last two axes" function would have the core dimensions signature |
In #8827 (comment), @charris suggested |
Changing the operation's spelling from a function to a property does not change my opinion on the semantics :-) |
I just merged |
Would it be possible to apply the
.T
syntax to 1-dimensional arrays? Or does this violate some mathematical assumption about transposition and dimensionality?The text was updated successfully, but these errors were encountered: