@@ -24,14 +24,14 @@ const ArrayInitializer = Union{UndefInitializer, Missing, Nothing}
24
24
OffsetArray(A, indices...)
25
25
26
26
Return an `AbstractArray` that shares element type and size with the first argument but
27
- uses the supplied `indices` to infer its axes. If all the indices are `AbstractUnitRange`s then
28
- these are directly used as the axis span along each dimension. Refer to the examples below for other
27
+ uses the supplied `indices` to infer its axes. If all the indices are `AbstractUnitRange`s then
28
+ these are directly used as the axis span along each dimension. Refer to the examples below for other
29
29
permissible types.
30
30
31
- Alternatively it's possible to specify the coordinates of one corner of the array
32
- and have the axes be computed automatically from the size of `A`.
31
+ Alternatively it's possible to specify the coordinates of one corner of the array
32
+ and have the axes be computed automatically from the size of `A`.
33
33
This constructor makes it convenient to shift to
34
- an arbitrary starting index along each axis, for example to a zero-based indexing scheme followed by
34
+ an arbitrary starting index along each axis, for example to a zero-based indexing scheme followed by
35
35
arrays in languages such as C and Python.
36
36
See [`Origin`](@ref) and the examples below for this usage.
37
37
@@ -51,9 +51,9 @@ julia> A[0, 1]
51
51
5
52
52
```
53
53
54
- Examples of range-like types are: `UnitRange` (e.g, `-1:2`), `CartesianIndices`,
55
- and `Colon()` (or concisely `:`). A `UnitRange` specifies the axis span along one particular dimension,
56
- `CartesianIndices` specify the axis spans along multiple dimensions, and a `Colon` is a placeholder
54
+ Examples of range-like types are: `UnitRange` (e.g, `-1:2`), `CartesianIndices`,
55
+ and `Colon()` (or concisely `:`). A `UnitRange` specifies the axis span along one particular dimension,
56
+ `CartesianIndices` specify the axis spans along multiple dimensions, and a `Colon` is a placeholder
57
57
that specifies that the `OffsetArray` shares its axis with its parent along that dimension.
58
58
59
59
```jldoctest; setup=:(using OffsetArrays)
@@ -86,9 +86,9 @@ ERROR: [...]
86
86
87
87
# Example: origin
88
88
89
- [`OffsetArrays.Origin`](@ref) may be used to specify the origin of the OffsetArray. The term origin here
90
- refers to the corner with the lowest values of coordinates, such as the left edge for an `AbstractVector`,
91
- the bottom left corner for an `AbstractMatrix` and so on. The coordinates of the origin sets the starting
89
+ [`OffsetArrays.Origin`](@ref) may be used to specify the origin of the OffsetArray. The term origin here
90
+ refers to the corner with the lowest values of coordinates, such as the left edge for an `AbstractVector`,
91
+ the bottom left corner for an `AbstractMatrix` and so on. The coordinates of the origin sets the starting
92
92
index of the array along each dimension.
93
93
94
94
```jldoctest; setup=:(using OffsetArrays)
150
150
OffsetArray {eltype(A), ndims(A), typeof(A)} (A, offsets)
151
151
end
152
152
153
- # These methods are necessary to disallow incompatible dimensions for
153
+ # These methods are necessary to disallow incompatible dimensions for
154
154
# the OffsetVector and the OffsetMatrix constructors
155
155
for (FT, ND) in ((:OffsetVector , :1 ), (:OffsetMatrix , :2 ))
156
156
@eval @inline function $FT (A:: AbstractArray{<:Any,$ND} , offsets:: Tuple{Vararg{Integer}} )
@@ -185,7 +185,7 @@ for FT in (:OffsetArray, :OffsetVector, :OffsetMatrix)
185
185
lA = size (A)
186
186
lI = map (length, inds)
187
187
lA == lI || throw_dimerr (lA, lI)
188
- $ FT (A, map (_offset, axes (A), inds))
188
+ $ FT (A, map (_offset, axes (A), inds))
189
189
end
190
190
191
191
@eval @inline $ FT (A:: AbstractArray , inds:: Vararg ) = $ FT (A, inds)
@@ -372,7 +372,7 @@ function Base.inds2string(inds::Tuple{Vararg{Union{IdOffsetRange, IdentityUnitRa
372
372
Base. inds2string (map (UnitRange, inds))
373
373
end
374
374
Base. showindices (io:: IO , ind1:: IdOffsetRange , inds:: IdOffsetRange... ) = Base. showindices (io, map (UnitRange, (ind1, inds... ))... )
375
-
375
+
376
376
function Base. showarg (io:: IO , a:: OffsetArray , toplevel)
377
377
print (io, " OffsetArray(" )
378
378
Base. showarg (io, parent (a), false )
0 commit comments