You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found it strangely difficult to construct banded matrices. If I use the constructor
BandedMatrix((0=>Fill(1,n), ...), (m,n))
why do I have to specify both the size of the matrix, and the length of the diagonals?
Why not provide a constructor that takes numbers instead of vectors, e.g.,
BandedMatrix((0=>1, 1=>-1), (m,n))
where all sizes etc. are given by the diagonal indices and the size of the matrix?
If I provide a Fill(1,n) that is too long, there is a bounds error.
The text was updated successfully, but these errors were encountered:
We could change it to not produce the error when the vectors are the wrong length? That is, truncate or pad by zeros.
That would certainly be helpful. The reason I got so confused was error messages like this
julia>BandedMatrix((-1=>1:5, 2=>1:3), (3,3))
ERROR: BoundsError: attempt to access 4×3 Array{Int64,2} at index [4, 1:5]
Stacktrace:
[1] throw_boundserror(::Array{Int64,2}, ::Tuple{Int64,UnitRange{Int64}}) at ./abstractarray.jl:537
[2] checkbounds at ./abstractarray.jl:502 [inlined]
I couldn't easily see the relation between the dimensions of the inputs and those in the message. If I got a matrix printed in the terminal, I could inspect the result and see what dimension I got wrong.
I found it strangely difficult to construct banded matrices. If I use the constructor
why do I have to specify both the size of the matrix, and the length of the diagonals?
Why not provide a constructor that takes numbers instead of vectors, e.g.,
where all sizes etc. are given by the diagonal indices and the size of the matrix?
If I provide a
Fill(1,n)
that is too long, there is a bounds error.The text was updated successfully, but these errors were encountered: