diff --git a/Project.toml b/Project.toml index f3efdf3..cc18e35 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "BlockBandedMatrices" uuid = "ffab5731-97b5-5995-9138-79e8c1846df0" -version = "0.13.4" +version = "0.13.5" [deps] ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a" diff --git a/src/interfaceimpl.jl b/src/interfaceimpl.jl index 8e5885f..b47650a 100644 --- a/src/interfaceimpl.jl +++ b/src/interfaceimpl.jl @@ -57,6 +57,13 @@ function blockbandwidths(::AbstractBandedLayout, (a,b)::Tuple{AbstractBlockedUni end end +function blockbandwidths(::AbstractBandedLayout, (a,b)::Tuple{BlockedOneTo{<:Any,<:AbstractRange}, BlockedOneTo{<:Any,<:AbstractRange}}, A) + a ≠ b && return blockbandwidths(UnknownLayout(), (a,b), A) # can implement same step but not done yet + l,u = bandwidths(A) + s = step(a.lasts) # normal blocksize + (l+s-1) ÷ s, (u+s-1) ÷ s +end + diff --git a/test/test_misc.jl b/test/test_misc.jl index fc6d29d..d670aad 100644 --- a/test/test_misc.jl +++ b/test/test_misc.jl @@ -195,6 +195,7 @@ Base.size(F::FiniteDifference) = (F.n,F.n) @test blockrowsupport(B,Block(1)) == Block.(1:2) @test blockrowsupport(B,Block(4)) == Block.(3:5) + Q = Eye((a,))[:,Block(2)] @test Q isa BandedMatrix @test blockcolsupport(Q,Block(1)) == Block.(2:2) @@ -210,6 +211,9 @@ Base.size(F::FiniteDifference) = (F.n,F.n) B = _BandedMatrix(randn(5,length(a)), a, 3, 1) @test blockbandwidths(B) == (4,0) + + B = _BandedMatrix(BlockedArray(randn(5,length(a)),(Base.OneTo(5),a)), a, 3, 1) + @test blockbandwidths(B) == (2,1) end end