Skip to content

Commit

Permalink
move reduce(cat,...) below cat
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Abbott committed Oct 3, 2020
1 parent 20ec833 commit 011ef76
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions base/abstractarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1521,9 +1521,6 @@ reduce(::typeof(vcat), A::AbstractVector{<:AbstractVecOrMat}) =
reduce(::typeof(hcat), A::AbstractVector{<:AbstractVecOrMat}) =
_typed_hcat(mapreduce(eltype, promote_type, A), A)

reduce(::typeof(cat), A::AbstractArray{<:AbstractArray}) =
_typed_cat(mapreduce(eltype, promote_type, A), A)

function _typed_cat(::Type{T}, A::AbstractArray{<:AbstractArray{<:Any,N},M}) where {T,N,M}
ax1 = axes(first(A))
dense = true
Expand Down Expand Up @@ -1788,6 +1785,9 @@ julia> cat([1 1; 1 1], fill(√2,2,2), [4 8; 16 32])

_cat(catdims, A::AbstractArray{T}...) where {T} = cat_t(T, A...; dims=catdims)

reduce(::typeof(cat), A::AbstractArray{<:AbstractArray}) =
_typed_cat(mapreduce(eltype, promote_type, A), A)

# The specializations for 1 and 2 inputs are important
# especially when running with --inline=no, see #11158
vcat(A::AbstractArray) = cat(A; dims=Val(1))
Expand Down

0 comments on commit 011ef76

Please sign in to comment.