@@ -86,7 +86,7 @@ julia> axes(A)
86
86
"""
87
87
function axes (A)
88
88
@_inline_meta
89
- map (OneTo , size (A))
89
+ map (oneto , size (A))
90
90
end
91
91
92
92
"""
@@ -107,10 +107,10 @@ require_one_based_indexing(A...) = !has_offset_axes(A...) || throw(ArgumentError
107
107
# in other applications.
108
108
axes1 (A:: AbstractArray{<:Any,0} ) = OneTo (1 )
109
109
axes1 (A:: AbstractArray ) = (@_inline_meta ; axes (A)[1 ])
110
- axes1 (iter) = OneTo (length (iter))
110
+ axes1 (iter) = oneto (length (iter))
111
111
112
112
unsafe_indices (A) = axes (A)
113
- unsafe_indices (r:: AbstractRange ) = (OneTo (unsafe_length (r)),) # Ranges use checked_sub for size
113
+ unsafe_indices (r:: AbstractRange ) = (oneto (unsafe_length (r)),) # Ranges use checked_sub for size
114
114
115
115
keys (a:: AbstractArray ) = CartesianIndices (axes (a))
116
116
keys (a:: AbstractVector ) = LinearIndices (a)
@@ -308,7 +308,7 @@ function eachindex(A::AbstractArray, B::AbstractArray...)
308
308
@_inline_meta
309
309
eachindex (IndexStyle (A,B... ), A, B... )
310
310
end
311
- eachindex (:: IndexLinear , A:: AbstractArray ) = (@_inline_meta ; OneTo (length (A)))
311
+ eachindex (:: IndexLinear , A:: AbstractArray ) = (@_inline_meta ; oneto (length (A)))
312
312
eachindex (:: IndexLinear , A:: AbstractVector ) = (@_inline_meta ; axes1 (A))
313
313
function eachindex (:: IndexLinear , A:: AbstractArray , B:: AbstractArray... )
314
314
@_inline_meta
@@ -1481,12 +1481,11 @@ vcat(V::AbstractVector{T}...) where {T} = typed_vcat(T, V...)
1481
1481
# but that solution currently fails (see #27188 and #27224)
1482
1482
AbstractVecOrTuple{T} = Union{AbstractVector{<: T }, Tuple{Vararg{T}}}
1483
1483
1484
- function _typed_vcat (:: Type{T} , V:: AbstractVecOrTuple{AbstractVector} ) where T
1485
- n = 0
1486
- for Vk in V
1487
- n += Int (length (Vk)):: Int
1488
- end
1489
- a = similar (V[1 ], T, n)
1484
+ _typed_vcat_similar (V, T, n) = similar (V[1 ], T, n)
1485
+ _typed_vcat (:: Type{T} , V:: AbstractVecOrTuple{AbstractVector} ) where T =
1486
+ _typed_vcat! (_typed_vcat_similar (V, T, mapreduce (length, + , V)), V)
1487
+
1488
+ function _typed_vcat! (a:: AbstractVector{T} , V:: AbstractVecOrTuple{AbstractVector} ) where T
1490
1489
pos = 1
1491
1490
for k= 1 : Int (length (V)):: Int
1492
1491
Vk = V[k]
@@ -1632,15 +1631,15 @@ _cat(dims, X...) = cat_t(promote_eltypeof(X...), X...; dims=dims)
1632
1631
@inline cat_t (:: Type{T} , X... ; dims) where {T} = _cat_t (dims, T, X... )
1633
1632
@inline function _cat_t (dims, :: Type{T} , X... ) where {T}
1634
1633
catdims = dims2cat (dims)
1635
- shape = cat_shape (catdims, map (cat_size, X):: Tuple{Vararg{Union{Int,Dims}}} ) :: Dims
1634
+ shape = cat_shape (catdims, map (cat_size, X))
1636
1635
A = cat_similar (X[1 ], T, shape)
1637
1636
if count (! iszero, catdims):: Int > 1
1638
1637
fill! (A, zero (T))
1639
1638
end
1640
1639
return __cat (A, shape, catdims, X... )
1641
1640
end
1642
1641
1643
- function __cat (A, shape:: NTuple{M,Int } , catdims, X... ) where M
1642
+ function __cat (A, shape:: NTuple{M} , catdims, X... ) where M
1644
1643
N = M:: Int
1645
1644
offsets = zeros (Int, N)
1646
1645
inds = Vector {UnitRange{Int}} (undef, N)
0 commit comments