@@ -1644,8 +1644,12 @@ cat_ndims(a::AbstractArray) = ndims(a)
16441644cat_indices (A, d) = OneTo (1 )
16451645cat_indices (A:: AbstractArray , d) = axes (A, d)
16461646
1647- cat_similar (A, :: Type{T} , shape) where T = Array {T} (undef, shape)
1648- cat_similar (A:: AbstractArray , :: Type{T} , shape) where T = similar (A, T, shape)
1647+ cat_similar (A, :: Type{T} , shape:: Tuple ) where T = Array {T} (undef, shape)
1648+ cat_similar (A, :: Type{T} , shape:: Vector ) where T = Array {T} (undef, shape... )
1649+ cat_similar (A:: Array , :: Type{T} , shape:: Tuple ) where T = Array {T} (undef, shape)
1650+ cat_similar (A:: Array , :: Type{T} , shape:: Vector ) where T = Array {T} (undef, shape... )
1651+ cat_similar (A:: AbstractArray , T:: Type , shape:: Tuple ) = similar (A, T, shape)
1652+ cat_similar (A:: AbstractArray , T:: Type , shape:: Vector ) = similar (A, T, shape... )
16491653
16501654# These are for backwards compatibility (even though internal)
16511655cat_shape (dims, shape:: Tuple{Vararg{Int}} ) = shape
@@ -2204,7 +2208,7 @@ function _typed_hvncat(::Type{T}, ::Val{N}, as::AbstractArray...) where {T, N}
22042208 end
22052209 end
22062210
2207- A = Array {T, nd} (undef, ntuple (d -> cat_size (as[1 ], d), N - 1 )... , Ndim, ntuple (x -> 1 , nd - N)... )
2211+ A = cat_similar (as[ 1 ], T, ( ntuple (d -> size (as[1 ], d), N - 1 )... , Ndim, ntuple (x -> 1 , nd - N)... ) )
22082212 k = 1
22092213 for a ∈ as
22102214 for i ∈ eachindex (a)
@@ -2300,7 +2304,7 @@ function _typed_hvncat(::Type{T}, dims::Tuple{Vararg{Int, N}}, row_first::Bool,
23002304 len == outlen || ArgumentError (" too many elements in arguments; expected $(outlen) , got $(len) " ) |> throw
23012305
23022306 # copy into final array
2303- A = Array {T, nd} (undef , outdims... )
2307+ A = cat_similar (as[ 1 ], T , outdims)
23042308 # @assert all(==(0), currentdims)
23052309 outdims .= 0
23062310 hvncat_fill! (A, currentdims, outdims, d1, d2, as)
@@ -2361,12 +2365,12 @@ function _typed_hvncat(::Type{T}, shape::Tuple{Vararg{Tuple, N}}, row_first::Boo
23612365 # @assert all(==(0), blockcounts)
23622366
23632367 # copy into final array
2364- A = Array {T, nd} (undef , outdims... )
2368+ A = cat_similar (as[ 1 ], T , outdims)
23652369 hvncat_fill! (A, currentdims, blockcounts, d1, d2, as)
23662370 return A
23672371end
23682372
2369- function hvncat_fill! (A:: Array {T, N} , scratch1:: Vector{Int} , scratch2:: Vector{Int} , d1:: Int , d2:: Int , as:: Tuple{Vararg} ) where {T, N}
2373+ function hvncat_fill! (A:: AbstractArray {T, N} , scratch1:: Vector{Int} , scratch2:: Vector{Int} , d1:: Int , d2:: Int , as:: Tuple{Vararg} ) where {T, N}
23702374 outdims = size (A)
23712375 offsets = scratch1
23722376 inneroffsets = scratch2
0 commit comments