-
-
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
transpose fails on a Matrix of Vectors #15512
Comments
A julia> a = [[i] for i in 1:3]
3-element Array{Array{Int64,1},1}:
[1]
[2]
[3]
julia> a'
ERROR: MethodError: Cannot `convert` an object of type Array{Int64,2} to an object of type Array{Int64,1}
You might have used a 2d row vector where a 1d column vector was required.
Note the difference between 1d column vector [1,2,3] and 2d row vector [1 2 3].
You can convert to a column vector with the vec() function.
This may have arisen from a call to the constructor Array{Int64,1}(...),
since type constructors fall back to convert methods.
Closest candidates are:
convert{T}(::Type{Array{T,1}}, ::Range{T})
convert{T,S,N}(::Type{Array{T,N}}, ::SubArray{S,N,P,I,L})
convert{T,n}(::Type{Array{T,n}}, ::Array{T,n})
...
[inlined code] from ./arraymath.jl:378
in ctranspose(::Array{Array{Int64,1},1}) at ./arraymath.jl:381
in eval(::Module, ::Any) at ./boot.jl:267 |
You are in for a ride #4774 |
Hmm. Perhaps not entirely orthogonal to the discussion in #4774 on whether transposition is an operation that interchanges some dimensions or one that turns a vector into a linear functional, is recursive "deeptranspose" really what
Does that seem right? |
Sorry for the delay here. I think both of your suggestions are good and it would be great if you would prepare a PR. |
Are there some things left to do here? |
I think there is. The original example still fails. |
Works on Julia master.
|
I think the behaviour should be along the lines of:
The text was updated successfully, but these errors were encountered: