@@ -104,7 +104,7 @@ function vect(X...)
104104 T = promote_typeof (X... )
105105 # T[ X[i] for i=1:length(X) ]
106106 # TODO : this is currently much faster. should figure out why. not clear.
107- return copyto! (Vector {T} (uninitialized , length (X)), X)
107+ return copyto! (Vector {T} (uninit , length (X)), X)
108108end
109109
110110size (a:: Array , d) = arraysize (a, d)
@@ -259,14 +259,14 @@ end
259259
260260# # Constructors ##
261261
262- similar (a:: Array{T,1} ) where {T} = Vector {T} (uninitialized , size (a,1 ))
263- similar (a:: Array{T,2} ) where {T} = Matrix {T} (uninitialized , size (a,1 ), size (a,2 ))
264- similar (a:: Array{T,1} , S:: Type ) where {T} = Vector {S} (uninitialized , size (a,1 ))
265- similar (a:: Array{T,2} , S:: Type ) where {T} = Matrix {S} (uninitialized , size (a,1 ), size (a,2 ))
266- similar (a:: Array{T} , m:: Int ) where {T} = Vector {T} (uninitialized , m)
267- similar (a:: Array , T:: Type , dims:: Dims{N} ) where {N} = Array {T,N} (uninitialized , dims)
268- similar (a:: Array{T} , dims:: Dims{N} ) where {T,N} = Array {T,N} (uninitialized , dims)
269- similar (:: Type{T} , shape:: Tuple ) where {T<: Array } = T (uninitialized , to_shape (shape))
262+ similar (a:: Array{T,1} ) where {T} = Vector {T} (uninit , size (a,1 ))
263+ similar (a:: Array{T,2} ) where {T} = Matrix {T} (uninit , size (a,1 ), size (a,2 ))
264+ similar (a:: Array{T,1} , S:: Type ) where {T} = Vector {S} (uninit , size (a,1 ))
265+ similar (a:: Array{T,2} , S:: Type ) where {T} = Matrix {S} (uninit , size (a,1 ), size (a,2 ))
266+ similar (a:: Array{T} , m:: Int ) where {T} = Vector {T} (uninit , m)
267+ similar (a:: Array , T:: Type , dims:: Dims{N} ) where {N} = Array {T,N} (uninit , dims)
268+ similar (a:: Array{T} , dims:: Dims{N} ) where {T,N} = Array {T,N} (uninit , dims)
269+ similar (:: Type{T} , shape:: Tuple ) where {T<: Array } = T (uninit , to_shape (shape))
270270
271271# T[x...] constructs Array{T,1}
272272"""
@@ -291,20 +291,20 @@ julia> getindex(Int8, 1, 2, 3)
291291```
292292"""
293293function getindex (:: Type{T} , vals... ) where T
294- a = Vector {T} (uninitialized , length (vals))
294+ a = Vector {T} (uninit , length (vals))
295295 @inbounds for i = 1 : length (vals)
296296 a[i] = vals[i]
297297 end
298298 return a
299299end
300300
301301getindex (:: Type{T} ) where {T} = (@_inline_meta ; Vector {T} ())
302- getindex (:: Type{T} , x) where {T} = (@_inline_meta ; a = Vector {T} (uninitialized , 1 ); @inbounds a[1 ] = x; a)
303- getindex (:: Type{T} , x, y) where {T} = (@_inline_meta ; a = Vector {T} (uninitialized , 2 ); @inbounds (a[1 ] = x; a[2 ] = y); a)
304- getindex (:: Type{T} , x, y, z) where {T} = (@_inline_meta ; a = Vector {T} (uninitialized , 3 ); @inbounds (a[1 ] = x; a[2 ] = y; a[3 ] = z); a)
302+ getindex (:: Type{T} , x) where {T} = (@_inline_meta ; a = Vector {T} (uninit , 1 ); @inbounds a[1 ] = x; a)
303+ getindex (:: Type{T} , x, y) where {T} = (@_inline_meta ; a = Vector {T} (uninit , 2 ); @inbounds (a[1 ] = x; a[2 ] = y); a)
304+ getindex (:: Type{T} , x, y, z) where {T} = (@_inline_meta ; a = Vector {T} (uninit , 3 ); @inbounds (a[1 ] = x; a[2 ] = y; a[3 ] = z); a)
305305
306306function getindex (:: Type{Any} , @nospecialize vals... )
307- a = Vector {Any} (uninitialized , length (vals))
307+ a = Vector {Any} (uninit , length (vals))
308308 @inbounds for i = 1 : length (vals)
309309 a[i] = vals[i]
310310 end
@@ -345,8 +345,8 @@ julia> fill(1.0, (5,5))
345345If `x` is an object reference, all elements will refer to the same object. `fill(Foo(),
346346dims)` will return an array filled with the result of evaluating `Foo()` once.
347347"""
348- fill (v, dims:: Dims ) = fill! (Array {typeof(v)} (uninitialized , dims), v)
349- fill (v, dims:: Integer... ) = fill! (Array {typeof(v)} (uninitialized , dims... ), v)
348+ fill (v, dims:: Dims ) = fill! (Array {typeof(v)} (uninit , dims), v)
349+ fill (v, dims:: Integer... ) = fill! (Array {typeof(v)} (uninit , dims... ), v)
350350
351351"""
352352 zeros([T=Float64,] dims...)
@@ -390,7 +390,7 @@ function ones end
390390
391391for (fname, felt) in ((:zeros , :zero ), (:ones , :one ))
392392 @eval begin
393- $ fname (:: Type{T} , dims:: NTuple{N, Any} ) where {T, N} = fill! (Array {T,N} (uninitialized , convert (Dims, dims):: Dims ), $ felt (T))
393+ $ fname (:: Type{T} , dims:: NTuple{N, Any} ) where {T, N} = fill! (Array {T,N} (uninit , convert (Dims, dims):: Dims ), $ felt (T))
394394 $ fname (dims:: Tuple ) = ($ fname)(Float64, dims)
395395 $ fname (:: Type{T} , dims... ) where {T} = $ fname (T, dims)
396396 $ fname (dims... ) = $ fname (dims)
@@ -422,7 +422,7 @@ promote_rule(a::Type{Array{T,n}}, b::Type{Array{S,n}}) where {T,n,S} = el_same(p
422422
423423if nameof (@__MODULE__ ) === :Base # avoid method overwrite
424424# constructors should make copies
425- Array {T,N} (x:: AbstractArray{S,N} ) where {T,N,S} = copyto! (Array {T,N} (uninitialized , size (x)), x)
425+ Array {T,N} (x:: AbstractArray{S,N} ) where {T,N,S} = copyto! (Array {T,N} (uninit , size (x)), x)
426426AbstractArray {T,N} (A:: AbstractArray{S,N} ) where {T,N,S} = copyto! (similar (A,T), A)
427427end
428428
@@ -445,7 +445,7 @@ julia> collect(Float64, 1:2:5)
445445"""
446446collect (:: Type{T} , itr) where {T} = _collect (T, itr, IteratorSize (itr))
447447
448- _collect (:: Type{T} , itr, isz:: HasLength ) where {T} = copyto! (Vector {T} (uninitialized , Int (length (itr):: Integer )), itr)
448+ _collect (:: Type{T} , itr, isz:: HasLength ) where {T} = copyto! (Vector {T} (uninit , Int (length (itr):: Integer )), itr)
449449_collect (:: Type{T} , itr, isz:: HasShape ) where {T} = copyto! (similar (Array{T}, axes (itr)), itr)
450450function _collect (:: Type{T} , itr, isz:: SizeUnknown ) where T
451451 a = Vector {T} ()
@@ -499,11 +499,11 @@ function _collect(cont, itr, ::HasEltype, isz::SizeUnknown)
499499 return a
500500end
501501
502- _collect_indices (:: Tuple{} , A) = copyto! (Array {eltype(A),0} (uninitialized ), A)
502+ _collect_indices (:: Tuple{} , A) = copyto! (Array {eltype(A),0} (uninit ), A)
503503_collect_indices (indsA:: Tuple{Vararg{OneTo}} , A) =
504- copyto! (Array {eltype(A)} (uninitialized , length .(indsA)), A)
504+ copyto! (Array {eltype(A)} (uninit , length .(indsA)), A)
505505function _collect_indices (indsA, A)
506- B = Array {eltype(A)} (uninitialized , length .(indsA))
506+ B = Array {eltype(A)} (uninit , length .(indsA))
507507 copyto! (B, CartesianIndices (axes (B)), A, CartesianIndices (indsA))
508508end
509509
535535 end
536536end
537537
538- _array_for (:: Type{T} , itr, :: HasLength ) where {T} = Vector {T} (uninitialized , Int (length (itr):: Integer ))
538+ _array_for (:: Type{T} , itr, :: HasLength ) where {T} = Vector {T} (uninit , Int (length (itr):: Integer ))
539539_array_for (:: Type{T} , itr, :: HasShape ) where {T} = similar (Array{T}, axes (itr)):: Array{T}
540540
541541function collect (itr:: Generator )
@@ -1464,7 +1464,7 @@ function vcat(arrays::Vector{T}...) where T
14641464 for a in arrays
14651465 n += length (a)
14661466 end
1467- arr = Vector {T} (uninitialized , n)
1467+ arr = Vector {T} (uninit , n)
14681468 ptr = pointer (arr)
14691469 if isbits (T)
14701470 elsz = Core. sizeof (T)
@@ -1966,7 +1966,7 @@ end
19661966# Allocating result upfront is faster (possible only when collection can be iterated twice)
19671967function findall (A:: AbstractArray{Bool} )
19681968 n = count (A)
1969- I = Vector {eltype(keys(A))} (uninitialized , n)
1969+ I = Vector {eltype(keys(A))} (uninit , n)
19701970 cnt = 1
19711971 for (i,a) in pairs (A)
19721972 if a
0 commit comments