@@ -2,8 +2,6 @@ __precompile__()
2
2
3
3
module OffsetArrays
4
4
5
- Base. @deprecate_binding (.. ) Colon ()
6
-
7
5
using Base: Indices, tail
8
6
using Compat
9
7
@@ -23,6 +21,8 @@ OffsetArray{T,N}(A::AbstractArray{T,N}, offsets::Vararg{Int,N}) =
23
21
(:: Type{OffsetArray{T,N}} ){T,N}(inds:: Indices{N} ) =
24
22
OffsetArray {T,N,Array{T,N}} (Array {T,N} (map (length, inds)), map (indexoffset, inds))
25
23
(:: Type{OffsetArray{T}} ){T,N}(inds:: Indices{N} ) = OffsetArray {T,N} (inds)
24
+ (:: Type{OffsetArray{T,N}} ){T,N}(inds:: Vararg{AbstractUnitRange,N} ) = OffsetArray {T,N} (inds)
25
+ (:: Type{OffsetArray{T}} ){T,N}(inds:: Vararg{AbstractUnitRange,N} ) = OffsetArray {T,N} (inds)
26
26
OffsetArray {T} (A:: AbstractArray{T,0} ) = OffsetArray {T,0,typeof(A)} (A, ())
27
27
OffsetArray {T,N} (:: Type{T} , inds:: Vararg{UnitRange{Int},N} ) = OffsetArray {T,N} (inds)
28
28
@@ -125,7 +125,7 @@ Base.fill(x, inds::Tuple{UnitRange,Vararg{UnitRange}}) =
125
125
# ## Low-level utilities ###
126
126
127
127
# Computing a shifted index (subtracting the offset)
128
- offset {N} (offsets:: NTuple{N,Int} , inds:: NTuple{N,Int} ) = _offset ((), offsets, inds)
128
+ @inline offset {N} (offsets:: NTuple{N,Int} , inds:: NTuple{N,Int} ) = _offset ((), offsets, inds)
129
129
_offset (out, :: Tuple{} , :: Tuple{} ) = out
130
130
@inline _offset (out, offsets, inds) =
131
131
_offset ((out... , inds[1 ]- offsets[1 ]), Base. tail (offsets), Base. tail (inds))
213
213
@inline unsafe_getindex (a:: OffsetSubArray , I:: Union{Integer,CartesianIndex} ...) = unsafe_getindex (a, Base. IteratorsMD. flatten (I)... )
214
214
@inline unsafe_setindex! (a:: OffsetSubArray , val, I:: Union{Integer,CartesianIndex} ...) = unsafe_setindex! (a, val, Base. IteratorsMD. flatten (I)... )
215
215
216
- # Deprecations
217
- import Base: zeros, ones
218
- @deprecate zeros (T:: Type , ind1:: UnitRange , ind2:: UnitRange , inds:: UnitRange... ) fill! (OffsetArray {T} ((ind1, ind2, inds... )), zero (T))
219
- @deprecate ones (T:: Type , ind1:: UnitRange , inds2:: UnitRange , inds:: UnitRange... ) fill! (OffsetArray {T} ((ind1, ind2, inds... )), one (T))
220
- @deprecate zeros (ind1:: UnitRange , ind2:: UnitRange , inds:: UnitRange... ) fill! (OffsetArray {Float64} ((ind1, ind2, inds... )), 0 )
221
- @deprecate ones (ind1:: UnitRange , ind2:: UnitRange , inds:: UnitRange... ) fill! (OffsetArray {Float64} ((ind1, ind2, inds... )), 1 )
222
-
223
216
end # module
0 commit comments