@@ -404,9 +404,11 @@ promote_to_arrays(n,k, ::Type{T}, A, B, Cs...) where {T} =
404404 (promote_to_arrays_ (n[k], T, A), promote_to_arrays_ (n[k+ 1 ], T, B), promote_to_arrays (n,k+ 2 , T, Cs... )... )
405405promote_to_array_type (A:: Tuple{Vararg{Union{AbstractVecOrMat,UniformScaling,Number}}} ) = Matrix
406406
407- for (f,dim,name) in ((:hcat ,1 , " rows" ), (:vcat ,2 , " cols" ))
407+ for (f, _f, dim, name) in ((:hcat , :_hcat , 1 , " rows" ), (:vcat , :_vcat , 2 , " cols" ))
408408 @eval begin
409- function $f (A:: Union{AbstractVecOrMat,UniformScaling,Number} ...)
409+ @inline $ f (A:: Union{AbstractVecOrMat,UniformScaling} ...) = $ _f (A... )
410+ @inline $ f (A:: Union{AbstractVecOrMat,UniformScaling,Number} ...) = $ _f (A... )
411+ function $_f (A:: Union{AbstractVecOrMat,UniformScaling,Number} ...)
410412 n = - 1
411413 for a in A
412414 if ! isa (a, UniformScaling)
@@ -424,8 +426,9 @@ for (f,dim,name) in ((:hcat,1,"rows"), (:vcat,2,"cols"))
424426 end
425427end
426428
427-
428- function hvcat (rows:: Tuple{Vararg{Int}} , A:: Union{AbstractVecOrMat,UniformScaling,Number} ...)
429+ hvcat (rows:: Tuple{Vararg{Int}} , A:: Union{AbstractVecOrMat,UniformScaling} ...) = _hvcat (rows, A... )
430+ hvcat (rows:: Tuple{Vararg{Int}} , A:: Union{AbstractVecOrMat,UniformScaling,Number} ...) = _hvcat (rows, A... )
431+ function _hvcat (rows:: Tuple{Vararg{Int}} , A:: Union{AbstractVecOrMat,UniformScaling,Number} ...)
429432 require_one_based_indexing (A... )
430433 nr = length (rows)
431434 sum (rows) == length (A) || throw (ArgumentError (" mismatch between row sizes and number of arguments" ))
0 commit comments