Skip to content

Commit a4e3cd2

Browse files
committed
Replace full(X) calls with convert(Array, X) elsewhere in base/ (outside base/sparse and base/linalg), apart from the no-op fallback for AbstractArrays in abstractarray.jl.
1 parent bd3c3ac commit a4e3cd2

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

base/abstractarray.jl

+5-5
Original file line numberDiff line numberDiff line change
@@ -896,7 +896,7 @@ function typed_vcat{T}(::Type{T}, V::AbstractVector...)
896896
for Vk in V
897897
n += length(Vk)
898898
end
899-
a = similar(full(V[1]), T, n)
899+
a = similar(convert(Array, V[1]), T, n)
900900
pos = 1
901901
for k=1:length(V)
902902
Vk = V[k]
@@ -924,7 +924,7 @@ function typed_hcat{T}(::Type{T}, A::AbstractVecOrMat...)
924924
nd = ndims(Aj)
925925
ncols += (nd==2 ? size(Aj,2) : 1)
926926
end
927-
B = similar(full(A[1]), T, nrows, ncols)
927+
B = similar(convert(Array, A[1]), T, nrows, ncols)
928928
pos = 1
929929
if dense
930930
for k=1:nargs
@@ -956,7 +956,7 @@ function typed_vcat{T}(::Type{T}, A::AbstractMatrix...)
956956
throw(ArgumentError("number of columns of each array must match (got $(map(x->size(x,2), A)))"))
957957
end
958958
end
959-
B = similar(full(A[1]), T, nrows, ncols)
959+
B = similar(convert(Array, A[1]), T, nrows, ncols)
960960
pos = 1
961961
for k=1:nargs
962962
Ak = A[k]
@@ -1003,7 +1003,7 @@ function cat_t(catdims, typeC::Type, X...)
10031003
end
10041004
end
10051005

1006-
C = similar(isa(X[1],AbstractArray) ? full(X[1]) : [X[1]], typeC, tuple(dimsC...))
1006+
C = similar(isa(X[1],AbstractArray) ? convert(Array, X[1]) : [X[1]], typeC, tuple(dimsC...))
10071007
if length(catdims)>1
10081008
fill!(C,0)
10091009
end
@@ -1075,7 +1075,7 @@ function typed_hvcat{T}(::Type{T}, rows::Tuple{Vararg{Int}}, as::AbstractMatrix.
10751075
a += rows[i]
10761076
end
10771077

1078-
out = similar(full(as[1]), T, nr, nc)
1078+
out = similar(convert(Array, as[1]), T, nr, nc)
10791079

10801080
a = 1
10811081
r = 1

base/test.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -817,7 +817,7 @@ end
817817

818818
approx_full(x::AbstractArray) = x
819819
approx_full(x::Number) = x
820-
approx_full(x) = full(x)
820+
approx_full(x) = convert(Array, x)
821821

822822
function test_approx_eq(va, vb, Eps, astr, bstr)
823823
va = approx_full(va)

0 commit comments

Comments
 (0)