Internal Documentation

Contents

Index

Internals

BlockArrays.blockcolsupportFunction
blockcolsupport(A, j)

Return an iterator containing the possible non-zero blocks in the j-th block-column of A.

Examples

julia> B = BlockArray(collect(reshape(1:9, 3, 3)), [1,2], [1,1,1])
2×3-blocked 3×3 BlockMatrix{Int64}:
 1  │  4  │  7
 ───┼─────┼───
 2  │  5  │  8
 3  │  6  │  9

julia> BlockArrays.blockcolsupport(B, 2) |> collect
2-element Vector{Block{1, Int64}}:
 Block(1)
 Block(2)
source
BlockArrays.blockrowsupportFunction
blockrowsupport(A, k)

Return an iterator containing the possible non-zero blocks in the k-th block-row of A.

Examples

julia> B = BlockArray(collect(reshape(1:9, 3, 3)), [1,2], [1,1,1])
2×3-blocked 3×3 BlockMatrix{Int64}:
 1  │  4  │  7
 ───┼─────┼───
 2  │  5  │  8
 3  │  6  │  9

julia> BlockArrays.blockrowsupport(B, 2) |> collect
3-element Vector{Block{1, Int64}}:
 Block(1)
 Block(2)
 Block(3)
source
BlockArrays.BlockedUnitRangeType
BlockedUnitRange

is an AbstractUnitRange{Int} that has been divided into blocks, and is used to represent axes of block arrays. Construction is typically via blockedrange which converts a vector of block lengths to a BlockedUnitRange.

Examples

julia> blockedrange([2,2,3])
3-blocked 7-element BlockedUnitRange{Vector{Int64}}:
 1
 2
 ─
 3
 4
 ─
 5
 6
 7
source
BlockArrays.BlockRangeType
BlockRange(axes::Tuple{AbstractUnitRange{Int}})
BlockRange(sizes::Vararg{Integer})

Represent a Cartesian range of blocks.

The relationship between Block and BlockRange mimics the relationship between CartesianIndex and CartesianIndices.

Examples

julia> BlockRange(2:3, 3:4) |> collect
2×2 Matrix{Block{2, Int64}}:
 Block(2, 3)  Block(2, 4)
 Block(3, 3)  Block(3, 4)

julia> BlockRange(2, 2) |> collect # number of elements, starting at 1
2×2 Matrix{Block{2, Int64}}:
 Block(1, 1)  Block(1, 2)
 Block(2, 1)  Block(2, 2)

julia> Block(1):Block(2)
BlockRange(1:2)
source
BlockArrays.BlockSliceType
BlockSlice(indices)

Represent an AbstractUnitRange of indices that attaches a block.

Upon calling to_indices(), Blocks are converted to BlockSlice objects to represent the indices over which the Block spans.

This mimics the relationship between Colon and Base.Slice.

source
BlockArrays.unblockFunction
unblock(block_sizes, inds, I)

Returns the indices associated with a block as a BlockSlice.

source
BlockArrays.SubBlockIteratorType
SubBlockIterator(subblock_lasts::Vector{Int}, block_lasts::Vector{Int})
SubBlockIterator(A::AbstractArray, bs::NTuple{N,AbstractUnitRange{Int}} where N, dim::Integer)

Return an iterator over the BlockIndexRanges of the blocks specified by subblock_lasts. The Block index part of BlockIndexRange is determined by subblock_lasts. That is to say, the Block index first specifies one of the block represented by subblock_lasts and then the inner-block index range specifies the region within the block. Each such block corresponds to a block specified by blocklasts.

Note that the invariance subblock_lasts ⊂ block_lasts must hold and must be ensured by the caller.

Examples

julia> using BlockArrays

julia> import BlockArrays: SubBlockIterator

julia> A = BlockArray(1:6, 1:3);

julia> subblock_lasts = blocklasts(axes(A, 1))
3-element ArrayLayouts.RangeCumsum{Int64, UnitRange{Int64}}:
 1
 3
 6

julia> block_lasts = [1, 3, 4, 6];

julia> itr = SubBlockIterator(subblock_lasts, block_lasts)
SubBlockIterator([1, 3, 6], [1, 3, 4, 6])

julia> collect(itr)
4-element Vector{BlockArrays.BlockIndexRange{1, Tuple{UnitRange{Int64}}}}:
 Block(1)[1:1]
 Block(2)[1:2]
 Block(3)[1:1]
 Block(3)[2:3]
source
BlockArrays.blockcheckbounds_indicesFunction
blockcheckbounds_indices(Bool, IA::Tuple{Vararg{BlockRange{1}}}, I::Tuple{Vararg{Integer}})

Return true if the "requested" indices in the tuple Block.(I) fall within the bounds of the "permitted" indices specified by the tuple IA. This function recursively consumes elements of these tuples in a 1-for-1 fashion.

The actual bounds-checking is performed by blockcheckindex.

Examples

julia> B = BlockArray(zeros(6,6), 1:3, 1:3);

julia> blockaxes(B)
(BlockRange(Base.OneTo(3)), BlockRange(Base.OneTo(3)))

julia> BlockArrays.blockcheckbounds_indices(Bool, blockaxes(B), (1,2))
true

julia> BlockArrays.blockcheckbounds_indices(Bool, blockaxes(B), (4,1))
false
source
BlockArrays.blockcheckindexFunction
blockcheckindex(Bool, inds::BlockRange{1}, index::Integer)

Return true if Block(index) is within the bounds of inds.

Examples

julia> BlockArrays.blockcheckindex(Bool, BlockRange(1:2), 1)
true

julia> BlockArrays.blockcheckindex(Bool, BlockRange(1:2), 3)
false
source