Skip to content

Commit 89a2500

Browse files
authored
Merge pull request #17660 from Sacha0/defullconcat
Remove `full` from `similar(full(X), T, dims)` calls in generic concatenation methods.
2 parents a05852b + c9bd807 commit 89a2500

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

base/abstractarray.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,7 +1014,7 @@ function typed_vcat{T}(::Type{T}, V::AbstractVector...)
10141014
for Vk in V
10151015
n += length(Vk)
10161016
end
1017-
a = similar(full(V[1]), T, n)
1017+
a = similar(V[1], T, n)
10181018
pos = 1
10191019
for k=1:length(V)
10201020
Vk = V[k]
@@ -1042,7 +1042,7 @@ function typed_hcat{T}(::Type{T}, A::AbstractVecOrMat...)
10421042
nd = ndims(Aj)
10431043
ncols += (nd==2 ? size(Aj,2) : 1)
10441044
end
1045-
B = similar(full(A[1]), T, nrows, ncols)
1045+
B = similar(A[1], T, nrows, ncols)
10461046
pos = 1
10471047
if dense
10481048
for k=1:nargs
@@ -1074,7 +1074,7 @@ function typed_vcat{T}(::Type{T}, A::AbstractMatrix...)
10741074
throw(ArgumentError("number of columns of each array must match (got $(map(x->size(x,2), A)))"))
10751075
end
10761076
end
1077-
B = similar(full(A[1]), T, nrows, ncols)
1077+
B = similar(A[1], T, nrows, ncols)
10781078
pos = 1
10791079
for k=1:nargs
10801080
Ak = A[k]
@@ -1303,7 +1303,7 @@ function typed_hvcat{T}(::Type{T}, rows::Tuple{Vararg{Int}}, as::AbstractMatrix.
13031303
a += rows[i]
13041304
end
13051305

1306-
out = similar(full(as[1]), T, nr, nc)
1306+
out = similar(as[1], T, nr, nc)
13071307

13081308
a = 1
13091309
r = 1

0 commit comments

Comments
 (0)