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
Document recursive (c)transpose #15795
Conversation
This seems like an improvement, so I support merging, but what if you have a matrix of eltype |
...depends on #4774. I didn't realize transpose is defined on types. That's weird. |
@JeffBezanson I don't think it really was, until this PR. It's just that there's a fallback |
I suppose one issue with defining it on types is that you'd have |
@simonster I suppose in that case a solution would be to extend the definition of transpose on types to operate through unions, but I agree that transpose on types is a bit weird to extend more generally beyond this hack. The behavior in this PR could be achieved by defining a special transposetype(x) = x
transposetype{T<:AbstractVector}(::Type{T}) = Matrix{eltype(T)}
transposetype(x::Union) = Union{(transposetype(t) for t in x.types)...} to be used in the allocations of As for whether or not we want |
documentation is always good for an RC. i'd suggest merging this before 0.5-RC1 |
needs a rebase, and some related behavior was changed with the now deprecated fallback |
I haven't looked at this in ages but I've seen some rumblings recently about a Alternatively, we can let #15512 stand and I can make a PR with only the doc changes. |
a PR with just the docs would be great. transpose being recursive was a surprise to me, and one shouldn't have to go digging in the issue tracker to learn it's supposed to be that way. |
The rebased version of this (#24891) was declared obsolete, so I assume this is as well. |
Notes:
ctranspose{T<:AbstractVector}(::Type{T})
is defined indirectly through the methods here: https://github.com/JuliaLang/julia/blob/master/base/operators.jl#L261transpose{T<:AbstractVector}(::Type{T}) = Matrix{eltype(T)}
is the correct definition for allsubtypes
of AbstractVector.