Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify and specify types in blockedrange-related docstrings #342

Merged
merged 1 commit into from
Mar 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions src/blockaxis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ Base.unitrange(b::BlockedUnitRange) = first(b):last(b)
Base.promote_rule(::Type{BlockedUnitRange{CS}}, ::Type{Base.OneTo{Int}}) where CS = UnitRange{Int}

"""
blockaxes(A)
blockaxes(A::AbstractArray)

Return the tuple of valid block indices for array `A`.

Expand Down Expand Up @@ -163,13 +163,13 @@ _blockaxes(b::Tuple) = (Block.(Base.OneTo(length(b))),)
blockaxes(b) = blockaxes.(axes(b), 1)

"""
blockaxes(A, d)
blockaxes(A::AbstractArray, d::Int)

Return the valid range of block indices for array `A` along dimension `d`.

# Examples
```jldoctest
julia> A = BlockArray([1,2,3],[2,1])
julia> A = BlockArray([1,2,3], [2,1])
2-blocked 3-element BlockVector{Int64}:
1
2
Expand All @@ -190,8 +190,8 @@ julia> blockaxes(A,1) |> collect
end

"""
blocksize(A)
blocksize(A,i)
blocksize(A::AbstractArray)
blocksize(A::AbstractArray, i::Int)

Return the tuple of the number of blocks along each
dimension. See also size and blocksizes.
Expand All @@ -217,8 +217,8 @@ blocksize(A,i) = length(blockaxes(A,i))
@inline blocklength(t) = prod(blocksize(t))

"""
blocksizes(A)
blocksizes(A,i)
blocksizes(A::AbstractArray)
blocksizes(A::AbstractArray, i::Int)

Return the tuple of the sizes of blocks along each
dimension. See also size and blocksize.
Expand Down Expand Up @@ -340,8 +340,8 @@ Return the first index of each block of `a`.

# Examples
```jldoctest
julia> b = blockedrange(1:3)
3-blocked 6-element BlockedUnitRange{ArrayLayouts.RangeCumsum{Int64, UnitRange{Int64}}}:
julia> b = blockedrange([1,2,3])
3-blocked 6-element BlockedUnitRange{Vector{Int64}}:
1
2
Expand All @@ -366,8 +366,8 @@ Return the last index of each block of `a`.

# Examples
```jldoctest
julia> b = blockedrange(1:3)
3-blocked 6-element BlockedUnitRange{ArrayLayouts.RangeCumsum{Int64, UnitRange{Int64}}}:
julia> b = blockedrange([1,2,3])
3-blocked 6-element BlockedUnitRange{Vector{Int64}}:
1
2
Expand All @@ -378,7 +378,7 @@ julia> b = blockedrange(1:3)
6

julia> blocklasts(b)
3-element ArrayLayouts.RangeCumsum{Int64, UnitRange{Int64}}:
3-element Vector{Int64}:
1
3
6
Expand All @@ -392,8 +392,8 @@ Return the length of each block of `a`.

# Examples
```jldoctest
julia> b = blockedrange(1:3)
3-blocked 6-element BlockedUnitRange{ArrayLayouts.RangeCumsum{Int64, UnitRange{Int64}}}:
julia> b = blockedrange([1,2,3])
3-blocked 6-element BlockedUnitRange{Vector{Int64}}:
1
2
Expand Down
Loading