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 Feb 23, 2021
1 parent d971d83 commit db3547c
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 @@ -1873,6 +1873,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 @@ -1889,7 +1892,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 db3547c

Please sign in to comment.