Skip to content

Commit faaadf9

Browse files
committed
More generic
1 parent e0f6761 commit faaadf9

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/BlockArraysExtensions/blockedunitrange.jl

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,16 @@ using BlockArrays:
1616
findblockindex,
1717
mortar
1818

19+
# Get the axis of each block of a blocked unit
20+
# range.
1921
function eachblockaxis(a::AbstractUnitRange)
20-
Base.require_one_based_indexing(a)
21-
return map(Base.OneTo, blocklengths(a))
22+
return map(only axes, blocks(a))
2223
end
2324

24-
function mortar_axis(axeses)
25-
return blockedrange(length.(axeses))
25+
# Take a collection of axes and mortar them
26+
# into a single blocked axis.
27+
function mortar_axis(axs)
28+
return blockedrange(length.(axs))
2629
end
2730

2831
# Custom `BlockedUnitRange` constructor that takes a unit range

0 commit comments

Comments
 (0)