Skip to content

Conversation

@max-vassili3v
Copy link
Contributor

I noticed that the following doesn't work:

julia> b = BandedMatrix(Ones(3, 9), (0, 0))
3×9 BandedMatrix{Float64} with bandwidths (0, 0):
 1.0   ⋅    ⋅    ⋅    ⋅    ⋅    ⋅    ⋅    ⋅
  ⋅   1.0   ⋅    ⋅    ⋅    ⋅    ⋅    ⋅    ⋅
  ⋅    ⋅   1.0   ⋅    ⋅    ⋅    ⋅    ⋅    ⋅

julia> b[:,6]
ERROR: BoundsError: attempt to access 3-element Vector{Float64} at index [1:5]
Stacktrace:
 [1] throw_boundserror(A::Vector{Float64}, I::Tuple{UnitRange{Int64}})
   @ Base .\abstractarray.jl:737
 [2] checkbounds
   @ .\abstractarray.jl:702 [inlined]
 [3] view
   @ .\subarray.jl:179 [inlined]
 [4] maybeview
   @ .\views.jl:148 [inlined]
 [5] dotview
   @ .\broadcast.jl:1244 [inlined]
 [6] getindex(A::BandedMatrix{Float64, Matrix{Float64}, Base.OneTo{Int64}}, ::Colon, j::Int64)
   @ BandedMatrices d:\Documents\Github\BandedMatrices.jl\src\banded\BandedMatrix.jl:423
 [7] top-level scope
   @ REPL[29]:1

I added a fix and updated the unit tests to cover it

@codecov
Copy link

codecov bot commented Aug 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.84%. Comparing base (47c15ab) to head (67d5f3f).
Report is 5 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #452      +/-   ##
==========================================
+ Coverage   89.61%   89.84%   +0.23%     
==========================================
  Files          25       25              
  Lines        3571     3643      +72     
==========================================
+ Hits         3200     3273      +73     
+ Misses        371      370       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dlfivefifty
Copy link
Member

Thanks!

@dlfivefifty dlfivefifty merged commit c6c3912 into JuliaLinearAlgebra:master Aug 21, 2024
@dlfivefifty
Copy link
Member

PS It's a good idea to bump the version number (in this case a patch version, i.e. increase y in 1.x.y) as then I can just tag a new release right away with the fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants