Skip to content

Commit

Permalink
parent(::BandedMatrix) returns the underlying data (#425)
Browse files Browse the repository at this point in the history
* parent(::BandedMatrix) returns the underlying data

* Undo accidental show revert
  • Loading branch information
jishnub authored Feb 5, 2024
1 parent 13b11fc commit 5ee8d5a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "BandedMatrices"
uuid = "aae01518-5342-5314-be14-df237901396f"
version = "1.5.0"
version = "1.6.0"

[deps]
ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"
Expand Down
2 changes: 2 additions & 0 deletions src/banded/BandedMatrix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ end

_BandedMatrix(data::AbstractMatrix, m::Integer, l, u) = _BandedMatrix(data, oneto(m), l, u)

Base.parent(B::BandedMatrix) = B.data

const DefaultBandedMatrix{T} = BandedMatrix{T,Matrix{T},OneTo{Int}}

bandedcolumns(_) = BandedColumns{UnknownLayout}()
Expand Down
6 changes: 6 additions & 0 deletions test/test_banded.jl
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ Base.similar(::MyMatrix, ::Type{T}, m::Int, n::Int) where T = MyMatrix{T}(undef,
@test BandedMatrix{Int64, typeof(matrix)}(matrix, (1, 1)).data isa typeof(matrix)
@test_throws UndefRefError BandedMatrix{Vector{Float64}}(undef, (5,5), (1,1))[1,1]

@testset "parent" begin
A = zeros(3,5)
B = _BandedMatrix(A, 5, 1, 1)
@test parent(B) === A
end

@testset "Construction from Diagonal" begin
D = Diagonal(1:4)
B1 = BandedMatrix(D)
Expand Down

2 comments on commit 5ee8d5a

@jishnub
Copy link
Member Author

@jishnub jishnub commented on 5ee8d5a Feb 5, 2024

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/100260

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 v1.6.0 -m "<description of version>" 5ee8d5abebf6274b20d102688ec64fbd9c686c88
git push origin v1.6.0

Also, note the warning: Version 1.6.0 skips over 1.5.0
This can be safely ignored. However, if you want to fix this you can do so. Call register() again after making the fix. This will update the Pull request.

Please sign in to comment.