Skip to content

Commit 8ddbcf9

Browse files
committed
Update docs
1 parent 720d2e7 commit 8ddbcf9

File tree

3 files changed

+33
-22
lines changed

3 files changed

+33
-22
lines changed

docs/src/lib/internals.md

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ Pages = ["internals.md"]
2121
```@docs
2222
blockcolsupport
2323
blockrowsupport
24+
blockedrange
25+
BlockedOneTo
2426
BlockedUnitRange
2527
BlockRange
2628
BlockIndexRange

docs/src/man/abstractblockarrayinterface.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# The block axis interface
22

3-
A block array's block structure is dictated by its axes, which
4-
are typically a `BlockedUnitRange` but may also be a `UnitRange`,
5-
which is assumed to be a single block, or other type that implements
3+
A block array's block structure is dictated by its axes. These
4+
are typically `BlockedOneTo`s, but may also be standard and non-blocked `AbstractUnitRange`s
5+
(which are assumed to correspond to a single block), or other type that implements
66
the block axis interface.
77

88

docs/src/man/blockarrays.md

+28-19
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@ end
1111
An `AbstractArray` can be repacked into a `BlockArray` with `BlockArray(array, block_sizes...)`. The block sizes are each an `AbstractVector{Int}` which determines the size of the blocks in that dimension (so the sum of `block_sizes` in every dimension must match the size of `array` in that dimension).
1212

1313
```jldoctest
14-
julia> BlockArray(Array(reshape(1:16, 4, 4)), [2,2], [1,1,2])
14+
julia> BlockArray(Array(reshape(1:16, 4, 4)), [1,3], [1,1,2])
1515
2×3-blocked 4×4 BlockMatrix{Int64}:
1616
1 │ 5 │ 9 13
17-
2 │ 6 │ 10 14
1817
───┼─────┼────────
18+
2 │ 6 │ 10 14
1919
3 │ 7 │ 11 15
2020
4 │ 8 │ 12 16
2121
2222
julia> S = spzeros(4,5); S[1,2] = S[4,3] = 1;
2323
2424
julia> block_array_sparse = BlockArray(S, [1,3], [2,3])
25-
2×2-blocked 4×5 BlockMatrix{Float64, Matrix{SparseMatrixCSC{Float64, Int64}}, Tuple{BlockedUnitRange{Vector{Int64}}, BlockedUnitRange{Vector{Int64}}}}:
25+
2×2-blocked 4×5 BlockMatrix{Float64, Matrix{SparseMatrixCSC{Float64, Int64}}, Tuple{BlockedOneTo{Vector{Int64}}, BlockedOneTo{Vector{Int64}}}}:
2626
⋅ 1.0 │ ⋅ ⋅ ⋅
2727
──────────┼───────────────
2828
⋅ ⋅ │ ⋅ ⋅ ⋅
@@ -67,7 +67,7 @@ The `block_type` should be an array type. It specifies the internal block type,
6767

6868
```jldoctest
6969
julia> BlockArray(undef_blocks, SparseVector{Float64, Int}, [1,2])
70-
2-blocked 3-element BlockVector{Float64, Vector{SparseVector{Float64, Int64}}, Tuple{BlockedUnitRange{Vector{Int64}}}}:
70+
2-blocked 3-element BlockVector{Float64, Vector{SparseVector{Float64, Int64}}, Tuple{BlockedOneTo{Vector{Int64}}}}:
7171
#undef
7272
──────
7373
#undef
@@ -138,27 +138,36 @@ julia> block_array[1, 2]
138138

139139
To view and modify blocks of `BlockArray` use the `view` syntax.
140140
```jldoctest
141-
julia> A = BlockArray(ones(6), 1:3);
141+
julia> A = BlockArray([11:16;], 1:3)
142+
3-blocked 6-element BlockVector{Int64, Vector{Vector{Int64}}, Tuple{BlockedOneTo{ArrayLayouts.RangeCumsum{Int64, UnitRange{Int64}}}}}:
143+
11
144+
──
145+
12
146+
13
147+
──
148+
14
149+
15
150+
16
142151
143152
julia> view(A, Block(2))
144-
2-element Vector{Float64}:
145-
1.0
146-
1.0
153+
2-element Vector{Int64}:
154+
12
155+
13
156+
157+
julia> view(A, Block(2)) .= [3,4];
147158
148-
julia> view(A, Block(2)) .= [3,4]; A[Block(2)]
149-
2-element Vector{Float64}:
150-
3.0
151-
4.0
159+
julia> A[Block(2)]
160+
2-element Vector{Int64}:
161+
3
162+
4
152163
153164
julia> view(A, Block.(1:2))
154-
3-element view(::BlockVector{Float64, Vector{Vector{Float64}}, Tuple{BlockedUnitRange{ArrayLayouts.RangeCumsum{Int64, UnitRange{Int64}}}}}, BlockSlice(BlockRange(1:2),1:1:3)) with eltype Float64 with indices 1:1:3:
155-
1.0
156-
3.0
157-
4.0
165+
3-element view(::BlockVector{Int64, Vector{Vector{Int64}}, Tuple{BlockedOneTo{ArrayLayouts.RangeCumsum{Int64, UnitRange{Int64}}}}}, BlockSlice(BlockRange(1:2),1:1:3)) with eltype Int64 with indices BlockedOneTo([1, 3]):
166+
11
167+
3
168+
4
158169
```
159170

160-
161-
162171
## Converting between `BlockArray` and normal arrays
163172

164173
An array can be repacked into a `BlockArray` with `BlockArray(array, block_sizes...)`:
@@ -167,7 +176,7 @@ An array can be repacked into a `BlockArray` with `BlockArray(array, block_sizes
167176
julia> S = spzeros(4,5); S[1,2] = S[4,3] = 1;
168177
169178
julia> block_array_sparse = BlockArray(S, [1,3], [2,3])
170-
2×2-blocked 4×5 BlockMatrix{Float64, Matrix{SparseMatrixCSC{Float64, Int64}}, Tuple{BlockedUnitRange{Vector{Int64}}, BlockedUnitRange{Vector{Int64}}}}:
179+
2×2-blocked 4×5 BlockMatrix{Float64, Matrix{SparseMatrixCSC{Float64, Int64}}, Tuple{BlockedOneTo{Vector{Int64}}, BlockedOneTo{Vector{Int64}}}}:
171180
⋅ 1.0 │ ⋅ ⋅ ⋅
172181
──────────┼───────────────
173182
⋅ ⋅ │ ⋅ ⋅ ⋅

0 commit comments

Comments
 (0)