diff --git a/src/BlockSkylineMatrix.jl b/src/BlockSkylineMatrix.jl index ccbc7f2..2c4edb5 100644 --- a/src/BlockSkylineMatrix.jl +++ b/src/BlockSkylineMatrix.jl @@ -6,7 +6,8 @@ checkbandwidths(N, M, l::AbstractVector{Int}, u::AbstractVector{Int}) = function bb_blockstarts(ax, l::AbstractVector{Int}, u::AbstractVector{Int}) N,M = blocksize.(ax,1) L,U = maximum(l), maximum(u) - b_start = BandedMatrix{Int}(undef, (N, M), (L, U)) + # zero-filled so in-band slots for blocks outside a column's own band read as 0 + b_start = BandedMatrix(Zeros{Int}(N, M), (L, U)) -L > U && return b_start checkbandwidths(N, M, l, u) diff --git a/test/test_blockskyline.jl b/test/test_blockskyline.jl index 5385648..79a3e1c 100644 --- a/test/test_blockskyline.jl +++ b/test/test_blockskyline.jl @@ -165,6 +165,14 @@ Random.seed!(0) s = split(sprint(show, "text/plain", B), '\n')[2] @test s == " 1 │ 0 0 │ ⋅ ⋅ ⋅ │ ⋅ ⋅ ⋅ ⋅" end + + @testset "block_starts" begin + # block (3,2) is in the band of block_starts but not stored, so must be 0 + bs = BlockBandedMatrices.BlockSkylineSizes([2,3,4], [1,2,3], [2,0,0], [0,1,1]) + @test Matrix(bs.block_starts) == [1 10 0; + 3 12 20; + 6 0 23] + end end end # module