Skip to content

Fix blockrowstart/stop #78

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

Merged
merged 3 commits into from
Jul 9, 2020
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ArrayLayouts = "0.3.3"
BandedMatrices = "0.15.14"
BlockArrays = "0.12.9"
FillArrays = "0.8.10"
MatrixFactorizations = "0.4.1"
MatrixFactorizations = "0.4.1, 0.5"
julia = "1.2"

[extras]
Expand Down
4 changes: 2 additions & 2 deletions src/AbstractBlockBandedMatrix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ for Func in (:blockbanded_blockcolstart, :blockbanded_blockcolstop, :blockbanded
end

blockbanded_blockcolstart(A, i::BlockRange) = blockbanded_blockcolstart(A, minimum(i))
blockbanded_blocktowstart(A, i::BlockRange) = blockbanded_blockrowstart(A, minimum(i))
blockbanded_blockrowstart(A, i::BlockRange) = blockbanded_blockrowstart(A, minimum(i))
blockbanded_blockcolstop(A, i::BlockRange) = blockbanded_blockcolstop(A, maximum(i))
blockbanded_blocktowstop(A, i::BlockRange) = blockbanded_blockrowstop(A, maximum(i))
blockbanded_blockrowstop(A, i::BlockRange) = blockbanded_blockrowstop(A, maximum(i))


@inline blockcolsupport(::AbstractBlockBandedLayout, A, i) = blockbanded_blockcolstart(A,i):blockbanded_blockcolstop(A,i)
Expand Down
21 changes: 20 additions & 1 deletion test/test_blockbanded.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using BlockArrays, BandedMatrices, BlockBandedMatrices, FillArrays, ArrayLayouts, LinearAlgebra, Test
import BlockBandedMatrices: MemoryLayout, ColumnMajor, BroadcastStyle, BlockBandedStyle
import BlockBandedMatrices: MemoryLayout, ColumnMajor, BroadcastStyle, BlockBandedStyle, blockrowsupport, blockcolsupport
import Base.Broadcast: materialize!

@testset "BlockBandedMatrix" begin
Expand Down Expand Up @@ -90,6 +90,25 @@ import Base.Broadcast: materialize!
@test ret[1,2] == 0
end

@testset "blockcol/rowsupport" begin
l , u = 1,2
N = M = 4
cols = rows = 1:N
A = BlockBandedMatrix{Int}(undef, rows,cols, (l,u))
A.data .= 1:length(A.data)

@test blockrowsupport(A, 1) == Block.(1:3)
@test blockrowsupport(A, 2) == Block.(1:4)
@test blockrowsupport(A, 3) == Block.(2:4)
@test blockrowsupport(A, Block.(3:4)) == Block.(2:4)

@test blockcolsupport(A, 1) == Block.(1:2)
@test blockcolsupport(A, 2) == Block.(1:3)
@test blockcolsupport(A, 3) == Block.(1:4)
@test blockcolsupport(A, 4) == Block.(2:4)
@test blockcolsupport(A, Block.(1:2)) == Block.(1:3)
end

@testset "block-banded matrix interface for blockranges" begin
l , u = 1,1
N = M = 4
Expand Down