Skip to content

Commit

Permalink
Couldn't directly use cat_similar (for now)
Browse files Browse the repository at this point in the history
  • Loading branch information
BioTurboNick committed May 20, 2021
1 parent d55e366 commit de41ca2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion base/abstractarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1943,6 +1943,9 @@ end
_ndims(a::AbstractArray) = ndims(a)
_ndims(::Any) = 0

_similar(a::AbstractArray, ::Type{T}, nr, nc) where T = similar(a, T, nr, nc)
_similar(::Any, ::Type{T}, nr, nc) where T = Array{T, 2}(undef, nr, nc)

function _typed_hvcat(::Type{T}, rows::Tuple{Vararg{Int}}, as...where T
# handles scalar, vector, and matrix inputs
    nbr = length(rows)  # number of block rows
Expand All @@ -1959,7 +1962,7 @@ function _typed_hvcat(::Type{T}, rows::Tuple{Vararg{Int}}, as...) where T
        a += rows[i]
    end

    out = cat_similar(as[1], T, nr, nc)
    out = _similar(as[1], T, nr, nc)
    a = 1
    r = 1
    for i = 1:nbr
Expand Down

0 comments on commit de41ca2

Please sign in to comment.