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

support general backends for BlockArray #76

Merged
merged 17 commits into from
Mar 14, 2019
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
more doc fixes
  • Loading branch information
dlfivefifty committed Mar 9, 2019

Verified

This commit was signed with the committer’s verified signature.
commit 4c459ddc204ef9fc03cf9a795a9260cace7d61db
12 changes: 6 additions & 6 deletions src/abstractblockarray.jl
Original file line number Diff line number Diff line change
@@ -139,11 +139,11 @@ julia> v = Array(reshape(1:6, (2, 3)))
1 3 5
2 4 6
julia> A = BlockArray(v, [1,1], [2,1])
2×2-blocked 2×3 BlockArray{Int64,2}:
1 3 │ 5
──────┼───
2 4 │ 6
julia> A = BlockArray(v, [1,1], [2,1])
2×2-blocked 2×3 BlockArray{Int64,2}:
1 3 │ 5
──────┼───
2 4 │ 6
julia> getblock(A, 2, 1)
1×2 Array{Int64,2}:
@@ -252,7 +252,7 @@ specialize this method if they need to provide custom block bounds checking beha
julia> A = BlockArray(rand(2,3), [1,1], [2,1]);
julia> blockcheckbounds(A, 3, 2)
ERROR: BlockBoundsError: attempt to access 2×2-blocked 2×3 BlockArray{Float64,2,Array{Float64,2}} at block index [3,2]
ERROR: BlockBoundsError: attempt to access 2×2-blocked 2×3 BlockArray{Float64,2,Array{Array{Float64,2},2},BlockArrays.BlockSizes{2,Array{Int64,1}}} at block index [3,2]
[...]
```
"""
18 changes: 9 additions & 9 deletions src/blockarray.jl
Original file line number Diff line number Diff line change
@@ -204,24 +204,24 @@ Construct a `BlockArray` from `blocks`. `block_sizes` is computed from
# Examples
```jldoctest; setup = quote using BlockArrays end
julia> blocks = permutedims(reshape([
1ones(1, 3), 2ones(1, 2),
3ones(2, 3), 4ones(2, 2),
], (2, 2)))
1ones(1, 3), 2ones(1, 2),
3ones(2, 3), 4ones(2, 2),
], (2, 2)))
2×2 Array{Array{Float64,2},2}:
[1.0 1.0 1.0] [2.0 2.0]
[1.0 1.0 1.0] [2.0 2.0]
[3.0 3.0 3.0; 3.0 3.0 3.0] [4.0 4.0; 4.0 4.0]
julia> mortar(blocks)
2×2-blocked 3×5 BlockArray{Float64,2}:
julia> mortar(blocks)
2×2-blocked 3×5 BlockArray{Float64,2}:
1.0 1.0 1.0 │ 2.0 2.0
───────────────┼──────────
3.0 3.0 3.0 │ 4.0 4.0
3.0 3.0 3.0 │ 4.0 4.0
julia> ans == mortar(
(1ones(1, 3), 2ones(1, 2)),
(3ones(2, 3), 4ones(2, 2)),
)
(1ones(1, 3), 2ones(1, 2)),
(3ones(2, 3), 4ones(2, 2)),
)
true
```
"""
14 changes: 7 additions & 7 deletions src/pseudo_blockarray.jl
Original file line number Diff line number Diff line change
@@ -28,16 +28,16 @@ julia> A = PseudoBlockArray(rand(2,3), [1,1], [2,1])
────────────────────┼──────────
0.849939 0.283365 │ 0.365801
julia> A = PseudoBlockArray(sprand(6, 0.5), [3,2,1])
3-blocked 6-element PseudoBlockArray{Float64,1,SparseVector{Float64,Int64},BlockArrays.BlockSizes{1,Array{Int64,1}}}:
0.0
0.5865981007905481
0.0
julia> A = PseudoBlockArray(sprand(6, 0.5), [3,2,1])
3-blocked 6-element PseudoBlockArray{Float64,1,SparseVector{Float64,Int64},BlockArrays.BlockSizes{1,Array{Int64,1}}}:
0.0
0.5865981007905481
0.0
───────────────────
0.05016684053503706
0.0
0.0
───────────────────
0.0
0.0
```
"""
struct PseudoBlockArray{T, N, R<:AbstractArray{T,N}, BS<:AbstractBlockSizes{N}} <: AbstractBlockArray{T, N}