Skip to content

Commit 29e8917

Browse files
committed
Replace collect with (Vector|Matrix|Array) in base/.
1 parent 070c66f commit 29e8917

11 files changed

+23
-23
lines changed

base/abstractarray.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1727,7 +1727,7 @@ for all `i` and `j`.
17271727
17281728
# Examples
17291729
```jldoctest
1730-
julia> a = reshape(collect(1:16),(2,2,2,2))
1730+
julia> a = reshape(Vector(1:16),(2,2,2,2))
17311731
2×2×2×2 Array{Int64,4}:
17321732
[:, :, 1, 1] =
17331733
1 3

base/abstractarraymath.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Elements of `dims` must be unique and within the range `1:ndims(A)`.
5151
5252
# Examples
5353
```jldoctest
54-
julia> a = reshape(collect(1:4),(2,2,1,1))
54+
julia> a = reshape(Vector(1:4),(2,2,1,1))
5555
2×2×1×1 Array{Int64,4}:
5656
[:, :, 1, 1] =
5757
1 3
@@ -186,7 +186,7 @@ first dimension.
186186
187187
# Examples
188188
```jldoctest
189-
julia> b = reshape(collect(1:16), (4,4))
189+
julia> b = reshape(Vector(1:16), (4,4))
190190
4×4 Array{Int64,2}:
191191
1 5 9 13
192192
2 6 10 14

base/array.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1334,7 +1334,7 @@ for reverse-order iteration without making a copy.
13341334
13351335
# Examples
13361336
```jldoctest
1337-
julia> A = collect(1:5)
1337+
julia> A = Vector(1:5)
13381338
5-element Array{Int64,1}:
13391339
1
13401340
2
@@ -1392,7 +1392,7 @@ In-place version of [`reverse`](@ref).
13921392
13931393
# Examples
13941394
```jldoctest
1395-
julia> A = collect(1:5)
1395+
julia> A = Vector(1:5)
13961396
5-element Array{Int64,1}:
13971397
1
13981398
2
@@ -2117,7 +2117,7 @@ The function `f` is passed one argument.
21172117
21182118
# Examples
21192119
```jldoctest
2120-
julia> filter!(isodd, collect(1:10))
2120+
julia> filter!(isodd, Vector(1:10))
21212121
5-element Array{Int64,1}:
21222122
1
21232123
3

base/linalg/qr.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ end
161161

162162
function qrfactPivotedUnblocked!(A::StridedMatrix)
163163
m, n = size(A)
164-
piv = collect(UnitRange{BlasInt}(1,n))
164+
piv = Vector(UnitRange{BlasInt}(1,n))
165165
τ = Vector{eltype(A)}(uninitialized, min(m,n))
166166
for j = 1:min(m,n)
167167

base/multidimensional.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ module IteratorsMD
3131
3232
# Examples
3333
```jldoctest
34-
julia> A = reshape(collect(1:16), (2, 2, 2, 2))
34+
julia> A = reshape(Vector(1:16), (2, 2, 2, 2))
3535
2×2×2×2 Array{Int64,4}:
3636
[:, :, 1, 1] =
3737
1 3
@@ -1306,7 +1306,7 @@ arrays have overlapping indices, then on the domain of the overlap
13061306
13071307
# Examples
13081308
```julia-repl
1309-
julia> src = reshape(collect(1:16), (4,4))
1309+
julia> src = reshape(Vector(1:16), (4,4))
13101310
4×4 Array{Int64,2}:
13111311
1 5 9 13
13121312
2 6 10 14
@@ -1706,7 +1706,7 @@ Return unique regions of `A` along dimension `dim`.
17061706
17071707
# Examples
17081708
```jldoctest
1709-
julia> A = map(isodd, reshape(collect(1:8), (2,2,2)))
1709+
julia> A = map(isodd, reshape(Vector(1:8), (2,2,2)))
17101710
2×2×2 Array{Bool,3}:
17111711
[:, :, 1] =
17121712
true true
@@ -1816,7 +1816,7 @@ Compute the minimum and maximum elements of an array over the given dimensions.
18161816
18171817
# Examples
18181818
```jldoctest
1819-
julia> A = reshape(collect(1:2:16), (2,2,2))
1819+
julia> A = reshape(Vector(1:2:16), (2,2,2))
18201820
2×2×2 Array{Int64,3}:
18211821
[:, :, 1] =
18221822
1 5

base/permuteddimsarray.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ See also: [`PermutedDimsArray`](@ref).
8787
8888
# Examples
8989
```jldoctest
90-
julia> A = reshape(collect(1:8), (2,2,2))
90+
julia> A = reshape(Vector(1:8), (2,2,2))
9191
2×2×2 Array{Int64,3}:
9292
[:, :, 1] =
9393
1 3

base/random/misc.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ optionally supplying the random-number generator `rng`.
158158
```jldoctest
159159
julia> rng = MersenneTwister(1234);
160160
161-
julia> shuffle!(rng, collect(1:16))
161+
julia> shuffle!(rng, Vector(1:16))
162162
16-element Array{Int64,1}:
163163
2
164164
15
@@ -204,7 +204,7 @@ indices, see [`randperm`](@ref).
204204
```jldoctest
205205
julia> rng = MersenneTwister(1234);
206206
207-
julia> shuffle(rng, collect(1:10))
207+
julia> shuffle(rng, Vector(1:10))
208208
10-element Array{Int64,1}:
209209
6
210210
1

base/reducedim.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ faster because the intermediate array is avoided.
255255
256256
# Examples
257257
```jldoctest
258-
julia> a = reshape(collect(1:16), (4,4))
258+
julia> a = reshape(Vector(1:16), (4,4))
259259
4×4 Array{Int64,2}:
260260
1 5 9 13
261261
2 6 10 14
@@ -289,7 +289,7 @@ associativity, e.g. left-to-right, you should write your own loop. See documenta
289289
290290
# Examples
291291
```jldoctest
292-
julia> a = reshape(collect(1:16), (4,4))
292+
julia> a = reshape(Vector(1:16), (4,4))
293293
4×4 Array{Int64,2}:
294294
1 5 9 13
295295
2 6 10 14

base/reshapedarray.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ the specified dimensions is equal to the length of the original array
5252
`A`. The total number of elements must not change.
5353
5454
```jldoctest
55-
julia> A = collect(1:16)
55+
julia> A = Vector(1:16)
5656
16-element Array{Int64,1}:
5757
1
5858
2

base/sparse/sparsematrix.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ end
729729

730730
function sparse(D::Diagonal{T}) where T
731731
m = length(D.diag)
732-
return SparseMatrixCSC(m, m, collect(1:(m+1)), collect(1:m), Vector{T}(D.diag))
732+
return SparseMatrixCSC(m, m, Vector(1:(m+1)), Vector(1:m), Vector{T}(D.diag))
733733
end
734734

735735
## Transposition and permutation methods

base/sparse/sparsevector.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ function sparsevec(I::AbstractVector{<:Integer}, V::AbstractVector, combine::Fun
188188
len = i
189189
end
190190
end
191-
_sparsevector!(collect(I), collect(V), len, combine)
191+
_sparsevector!(Vector(I), Vector(V), len, combine)
192192
end
193193

194194
function sparsevec(I::AbstractVector{<:Integer}, V::AbstractVector, len::Integer, combine::Function)
@@ -197,7 +197,7 @@ function sparsevec(I::AbstractVector{<:Integer}, V::AbstractVector, len::Integer
197197
for i in I
198198
1 <= i <= len || throw(ArgumentError("An index is out of bound."))
199199
end
200-
_sparsevector!(collect(I), collect(V), len, combine)
200+
_sparsevector!(Vector(I), Vector(V), len, combine)
201201
end
202202

203203
sparsevec(I::AbstractVector, V::Union{Number, AbstractVector}, args...) =
@@ -849,8 +849,8 @@ function SparseMatrixCSC{Tv,Ti}(x::AbstractSparseVector) where {Tv,Ti}
849849
colptr = Ti[1, m+1]
850850
# Note that this *cannot* share data like normal array conversions, since
851851
# modifying one would put the other in an inconsistent state
852-
rowval = collect(Ti, xnzind)
853-
nzval = collect(Tv, xnzval)
852+
rowval = Vector{Ti}(xnzind)
853+
nzval = Vector{Tv}(xnzval)
854854
SparseMatrixCSC(n, 1, colptr, rowval, nzval)
855855
end
856856

@@ -1934,7 +1934,7 @@ function sort(x::SparseVector{Tv,Ti}; kws...) where {Tv,Ti}
19341934
sinds = sortperm(allvals;kws...)
19351935
n,k = length(x),length(allvals)
19361936
z = findfirst(equalto(k),sinds)
1937-
newnzind = collect(Ti,1:k-1)
1937+
newnzind = Vector{Ti}(1:k-1)
19381938
newnzind[z:end] .+= n-k+1
19391939
newnzvals = allvals[deleteat!(sinds[1:k],z)]
19401940
SparseVector(n,newnzind,newnzvals)

0 commit comments

Comments
 (0)