@@ -311,12 +311,31 @@ end
311311
312312# deleted code that isn't used, such as 0-dimensional case
313313"""
314- BlockRange(startblock, stopblock)
314+ BlockRange(axes::Tuple{AbstractUnitRange{Int}})
315+ BlockRange(sizes::Vararg{Integer})
315316
316- represents a cartesian range of blocks.
317+ Represent a Cartesian range of blocks.
317318
318319The 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+ ```
320339"""
321340BlockRange
322341
@@ -326,8 +345,8 @@ BlockRange(inds::Vararg{AbstractUnitRange{Int},N}) where {N} =
326345 BlockRange (inds)
327346
328347BlockRange () = 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)
331350
332351(:)(start:: Block{1} , stop:: Block{1} ) = BlockRange ((first (start. n): first (stop. n),))
333352(:)(start:: Block , stop:: Block ) = throw (ArgumentError (" Use `BlockRange` to construct a cartesian range of blocks" ))
0 commit comments