Skip to content

Commit de41ca2

Browse files
committed
Couldn't directly use cat_similar (for now)
1 parent d55e366 commit de41ca2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

base/abstractarray.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1943,6 +1943,9 @@ end
19431943
_ndims(a::AbstractArray) = ndims(a)
19441944
_ndims(::Any) = 0
19451945

1946+
_similar(a::AbstractArray, ::Type{T}, nr, nc) where T = similar(a, T, nr, nc)
1947+
_similar(::Any, ::Type{T}, nr, nc) where T = Array{T, 2}(undef, nr, nc)
1948+
19461949
function _typed_hvcat(::Type{T}, rows::Tuple{Vararg{Int}}, as...where T
19471950
# handles scalar, vector, and matrix inputs
19481951
    nbr = length(rows)  # number of block rows
@@ -1959,7 +1962,7 @@ function _typed_hvcat(::Type{T}, rows::Tuple{Vararg{Int}}, as...) where T
19591962
        a += rows[i]
19601963
    end
19611964

1962-
    out = cat_similar(as[1], T, nr, nc)
1965+
    out = _similar(as[1], T, nr, nc)
19631966
    a = 1
19641967
    r = 1
19651968
    for i = 1:nbr

0 commit comments

Comments
 (0)