@@ -311,12 +311,31 @@ end
311
311
312
312
# deleted code that isn't used, such as 0-dimensional case
313
313
"""
314
- BlockRange(startblock, stopblock)
314
+ BlockRange(axes::Tuple{AbstractUnitRange{Int}})
315
+ BlockRange(sizes::Vararg{Integer})
315
316
316
- represents a cartesian range of blocks.
317
+ Represent a Cartesian range of blocks.
317
318
318
319
The relationship between `Block` and `BlockRange` mimics the relationship between
319
- `CartesianIndex` and `CartesianRange`.
320
+ `CartesianIndex` and `CartesianIndices`.
321
+
322
+ # Examples
323
+ ```jldoctest
324
+ julia> BlockRange(2,2)
325
+ 2×2 BlockRange{2, Tuple{Base.OneTo{Int64}, Base.OneTo{Int64}}}:
326
+ Block(1, 1) Block(1, 2)
327
+ Block(2, 1) Block(2, 2)
328
+
329
+ julia> BlockRange(2:3, 3:4)
330
+ 2×2 BlockRange{2, Tuple{UnitRange{Int64}, UnitRange{Int64}}}:
331
+ Block(2, 3) Block(2, 4)
332
+ Block(3, 3) Block(3, 4)
333
+
334
+ julia> Block(1):Block(2)
335
+ 2-element BlockRange{1, Tuple{UnitRange{Int64}}}:
336
+ Block(1)
337
+ Block(2)
338
+ ```
320
339
"""
321
340
BlockRange
322
341
@@ -326,8 +345,8 @@ BlockRange(inds::Vararg{AbstractUnitRange{Int},N}) where {N} =
326
345
BlockRange (inds)
327
346
328
347
BlockRange () = BlockRange (())
329
- BlockRange (sizes:: Tuple{Int , Vararg{Int }} ) = BlockRange (map (Base . OneTo , sizes))
330
- BlockRange (sizes:: Vararg{Int } ) = BlockRange (sizes)
348
+ BlockRange (sizes:: Tuple{Integer , Vararg{Integer }} ) = BlockRange (map (oneto , sizes))
349
+ BlockRange (sizes:: Vararg{Integer } ) = BlockRange (sizes)
331
350
332
351
(:)(start:: Block{1} , stop:: Block{1} ) = BlockRange ((first (start. n): first (stop. n),))
333
352
(:)(start:: Block , stop:: Block ) = throw (ArgumentError (" Use `BlockRange` to construct a cartesian range of blocks" ))
0 commit comments