Skip to content

Commit db3547c

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

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

base/abstractarray.jl

+4-1
Original file line numberDiff line numberDiff line change
@@ -1873,6 +1873,9 @@ end
18731873
_ndims(a::AbstractArray) = ndims(a)
18741874
_ndims(::Any) = 0
18751875

1876+
_similar(a::AbstractArray, ::Type{T}, nr, nc) where T = similar(a, T, nr, nc)
1877+
_similar(::Any, ::Type{T}, nr, nc) where T = Array{T, 2}(undef, nr, nc)
1878+
18761879
function _typed_hvcat(::Type{T}, rows::Tuple{Vararg{Int}}, as...where T
18771880
# handles scalar, vector, and matrix inputs
18781881
    nbr = length(rows)  # number of block rows
@@ -1889,7 +1892,7 @@ function _typed_hvcat(::Type{T}, rows::Tuple{Vararg{Int}}, as...) where T
18891892
        a += rows[i]
18901893
    end
18911894

1892-
    out = cat_similar(as[1], T, nr, nc)
1895+
    out = _similar(as[1], T, nr, nc)
18931896
    a = 1
18941897
    r = 1
18951898
    for i = 1:nbr

0 commit comments

Comments
 (0)