Skip to content

Slightly confusing error message when trying to set values out-off-bands #226

@jagot

Description

@jagot
julia> using BandedMatrices, FillArrays

julia> A = BandedMatrix(Zeros(243,241), (4,4));

julia> A[168,163] = 1
ERROR: attempt to access Matrix{Float64} with bandwidths (8, 240) at band -5
Stacktrace:
 [1] banded_setindex!
   @ ~/.julia/packages/BandedMatrices/ky92P/src/banded/BandedMatrix.jl:428 [inlined]
 [2] setindex!(A::BandedMatrix{Float64, Matrix{Float64}, Base.OneTo{Int64}}, v::Int64, k::Int64, j::Int64)
   @ BandedMatrices ~/.julia/packages/BandedMatrices/ky92P/src/banded/BandedMatrix.jl:437
 [3] top-level scope
   @ REPL[9]:1

Band -5 is correct, but I found it confusing that the underlying storage matrix is referenced in the error message, with bandwidths that don't match those of A.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions