Skip to content

Commit

Permalink
correct blockcolsupport when past block range (#176)
Browse files Browse the repository at this point in the history
* correct blockcolsupport when past block range

* v0.12.9

* Update test_adjtransblockbanded.jl

* Update test_adjtransblockbanded.jl
  • Loading branch information
dlfivefifty authored Dec 5, 2023
1 parent 868f55b commit 29fe0d7
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "BlockBandedMatrices"
uuid = "ffab5731-97b5-5995-9138-79e8c1846df0"
version = "0.12.8"
version = "0.12.9"

[deps]
ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"
Expand Down
14 changes: 11 additions & 3 deletions src/AbstractBlockBandedMatrix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ end
bs = blockcolstart(A,findblock(axes(A,2),i))
if isempty(axes(A,1))
1
elseif Int(bs) blocksize(A, 2)
elseif Int(bs) blocksize(A, 1)
first(axes(A,1)[bs])
else
size(A,1)+1
Expand All @@ -165,8 +165,16 @@ end
last(axes(A,1)[CS])
end

@inline blockbanded_rowstart(A, i::Integer) =
first(axes(A,2)[blockrowstart(A,findblock(axes(A,1),i))])
@inline function blockbanded_rowstart(A, i::Integer)
bs = blockrowstart(A,findblock(axes(A,1),i))
if isempty(axes(A,2))
1
elseif Int(bs) blocksize(A, 2)
first(axes(A,2)[bs])
else
size(A,2)+1
end
end

@inline function blockbanded_rowstop(A, i::Integer)
CS = blockrowstop(A,findblock(axes(A,1),i))
Expand Down
34 changes: 25 additions & 9 deletions test/test_adjtransblockbanded.jl
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
using ArrayLayouts
using BlockBandedMatrices
using Test

import BlockBandedMatrices: BandedBlockBandedRowMajor,
BandedBlockBandedRows,
BandedBlockBandedColumns,
BlockBandedRows,
BlockBandedColumns
using ArrayLayouts, BlockBandedMatrices, Test
import BlockBandedMatrices: BandedBlockBandedRowMajor, BandedBlockBandedRows,
BandedBlockBandedColumns, BlockBandedRows,
BlockBandedColumns, blockcolsupport, blockrowsupport

@testset "Adj/Trans" begin
@testset "BandedBlockBanded" begin
Expand Down Expand Up @@ -45,4 +40,25 @@ import BlockBandedMatrices: BandedBlockBandedRowMajor,
@test BlockBandedMatrix(A') == A'
@test BlockBandedMatrix(transpose(A)) == transpose(A)
end

@testset "blockcolsupport" begin
D_y = BandedBlockBandedMatrix{Float64}(undef, Fill(2,81), [3; Fill(2,79)], (0,0), (0,1))
@test colsupport(D_y, 161) == 159:160
@test rowsupport(D_y, 162) == 162:161
@test colsupport(D_y', 162) == 162:161
@test rowsupport(D_y', 161) == 159:160

@test blockcolsupport(D_y, Block(80)) == Block.(80:80)
@test blockrowsupport(D_y, Block(81)) == Block.(81:80)
@test blockcolsupport(D_y', Block(81)) == Block.(81:80)
@test blockrowsupport(D_y', Block(80)) == Block.(80:80)

E1 = BandedBlockBandedMatrix{Float64}(undef, Int[], [1], (0,0), (0,1))
@test colsupport(E1, 1) == 1:0
@test rowsupport(E1', 1) == 1:0

E2 = BandedBlockBandedMatrix{Float64}(undef, [1], Int[], (0,0), (0,1))
@test rowsupport(E2, 1) == 1:0
@test colsupport(E2', 1) == 1:0
end
end

2 comments on commit 29fe0d7

@dlfivefifty
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/96537

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.12.9 -m "<description of version>" 29fe0d7313af2beaf4bf136d120a71b92345432a
git push origin v0.12.9

Please sign in to comment.